Merge pull request #12 from gardenlinux/feat/semver #31
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release GLRD container image | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| jobs: | |
| build: | |
| name: build | |
| runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-latest-arm' || 'ubuntu-latest' }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [ amd64, arm64 ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Needed for poetry-dynamic-versioning | |
| - uses: ./.github/actions/setup | |
| - name: podman login | |
| run: | | |
| podman login -u token -p ${{ github.token }} ghcr.io | |
| - name: podman build | |
| run: | | |
| podman build --platform linux/${{ matrix.arch }} -t glrd . | |
| - name: podman build | |
| run: | | |
| podman save --format oci-archive glrd >/tmp/${{ matrix.arch }}-oci.tar | |
| - name: upload build-${{ matrix.arch }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-${{ matrix.arch }} | |
| path: /tmp/${{ matrix.arch }}-oci.tar | |
| if-no-files-found: error | |
| retention-days: 1 | |
| push: | |
| name: push | |
| runs-on: 'ubuntu-latest' | |
| defaults: | |
| run: | |
| shell: bash | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| - name: download build-amd64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-amd64 | |
| path: /tmp | |
| - name: download build-arm64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-arm64 | |
| path: /tmp | |
| - name: podman login | |
| run: | | |
| podman login -u token -p ${{ github.token }} ghcr.io | |
| - name: podman manifest | |
| run: | | |
| podman manifest create ghcr.io/${{ github.repository }} | |
| podman manifest add ghcr.io/${{ github.repository }} oci-archive:/tmp/amd64-oci.tar | |
| podman manifest add ghcr.io/${{ github.repository }} oci-archive:/tmp/arm64-oci.tar | |
| - name: podman push | |
| run: | | |
| version=${{ github.ref_name }} | |
| podman manifest push ghcr.io/${{ github.repository }} docker://ghcr.io/${{ github.repository }}:latest | |
| podman manifest push ghcr.io/${{ github.repository }} docker://ghcr.io/${{ github.repository }}:${version} | |
| release: | |
| name: Github Release | |
| runs-on: 'ubuntu-latest' | |
| needs: ['push'] | |
| steps: | |
| - name: Create Github Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ github.ref_name }} | |
| run: | | |
| gh release create "$tag" \ | |
| --repo="$GITHUB_REPOSITORY" \ | |
| --title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ | |
| --generate-notes |