Skip to content

upgrade photon 0.7.3 #21

upgrade photon 0.7.3

upgrade photon 0.7.3 #21

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/cache/restore@v4
with:
path: ~/.local/share/aquaproj-aqua
key: v1-aqua-installer-${{runner.os}}-${{runner.arch}}-${{hashFiles('aqua.yaml')}}
restore-keys: |
v1-aqua-installer-${{runner.os}}-${{runner.arch}}-
- uses: aquaproj/aqua-installer@e2d0136abcf70b7a2f6f505720640750557c4b33 # v3.1.1
with:
aqua_version: v2.46.0
- name: Run unit tests
run: |
make test
- name: Build all
run: |
make all
make archive
- name: Run e2e tests
run: |
make test-e2e
- name: upload e2e test logs
if: failure()
uses: actions/upload-artifact@v4
with:
path: e2e/logs
- name: upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: build.tar
- uses: actions/cache/save@v4
if: github.event_name == 'push'
with:
path: ~/.local/share/aquaproj-aqua
key: v1-aqua-installer-${{runner.os}}-${{runner.arch}}-${{hashFiles('aqua.yaml')}}
build-image:
runs-on: ubuntu-latest
needs: [test]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: build
- name: Extract artifacts
run: |
tar -xf build.tar
rm -f build.tar
- name: Get photon version
id: photon_metadata
run: |
source .env
echo "version=${PHOTON_VERSION}" >> $GITHUB_OUTPUT
echo "sha256=${PHOTON_SHA256SUM}" >> $GITHUB_OUTPUT
echo "revision=${CONTAINER_REVISION}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- name: Login to ghcr.io
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine image tags
id: tags
run: |
IMAGE=ghcr.io/pddg/photon
TAG="${{ steps.photon_metadata.outputs.version }}-rev.${{ steps.photon_metadata.outputs.revision }}"
if docker manifest inspect $IMAGE:$TAG > /dev/null 2>&1; then
echo "Tag $TAG already exists, skipping"
TAGS="latest"
else
echo "$TAG does not exist. It will be created."
TAGS="$TAG latest"
fi
echo "tags<<EOF" >> $GITHUB_OUTPUT
for t in $TAGS; do
echo $IMAGE:$t >> $GITHUB_OUTPUT
done
echo "EOF" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
build-args: |
PHOTON_VERSION=${{ steps.photon_metadata.outputs.version }}
PHOTON_SHA256SUM=${{ steps.photon_metadata.outputs.sha256 }}
GIT_SHA=${{ github.sha }}
tags: |
${{ steps.tags.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
release:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: [build-image]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: build
- name: Extract artifacts
run: |
tar -xf build.tar
rm -f build.tar
- name: create checksum file
run: |
sha256sum build/* > ./checksum.txt
mv ./checksum.txt build/
- name: create release if needs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
source .env
TAG="${PHOTON_VERSION}-rev.${CONTAINER_REVISION}"
if [ ! -z "$(git tag -l $TAG)" ]; then
echo "Tag $TAG already exists, skipping"
exit 0
fi
echo "Tag $TAG does not exist. It will be created."
gh release create $TAG \
--title "$TAG" \
--generate-notes \
build/*