From e45f2436f8766b409f1141545fb9c074bdaabc46 Mon Sep 17 00:00:00 2001 From: Jan Fooken Date: Tue, 17 Sep 2024 15:51:00 +0200 Subject: [PATCH 1/3] Publish image to GitHub container registry --- .github/workflows/ci.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 72eb459..9dd2e6b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -143,3 +143,34 @@ jobs: osc ar osc commit -m "New development version of $NAME released" + github-release-container: + name: Release container to GitHub container registry + runs-on: ubuntu-20.04 + if: github.ref == 'refs/heads/main' || github.event_name == 'release' + needs: [tlint] + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions-ecosystem/action-get-latest-tag@v1 + id: latest-tag + with: + semver_only: true + initial_version: 0.0.1 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and Push Docker Image + uses: docker/build-push-action@v6 + with: + push: true # Will only build if this is not here + tags: | + ghcr.io/${{ github.repository }}:{{ steps.latest-tag.outputs.tag }} + ghcr.io/${{ github.repository }}:latest From 5f5d6a256b960e91e81378b9cb31be1b7e6d5fa3 Mon Sep 17 00:00:00 2001 From: Jan Fooken Date: Tue, 17 Sep 2024 15:53:27 +0200 Subject: [PATCH 2/3] Fix missing $ sign --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9dd2e6b..38e9f9d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -172,5 +172,5 @@ jobs: with: push: true # Will only build if this is not here tags: | - ghcr.io/${{ github.repository }}:{{ steps.latest-tag.outputs.tag }} + ghcr.io/${{ github.repository }}:${{ steps.latest-tag.outputs.tag }} ghcr.io/${{ github.repository }}:latest From e2819933fc17ecbacd3928e36d04d5c051b4ce0b Mon Sep 17 00:00:00 2001 From: Jan Fooken Date: Tue, 17 Sep 2024 16:35:24 +0200 Subject: [PATCH 3/3] Adopt usual tags used by trento --- .github/workflows/ci.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 38e9f9d..24aeb17 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -148,6 +148,8 @@ jobs: runs-on: ubuntu-20.04 if: github.ref == 'refs/heads/main' || github.event_name == 'release' needs: [tlint] + env: + IMAGE_TAG: "${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'push' && github.ref_name == 'main' && 'rolling') || github.sha }}" steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.12.1 @@ -156,11 +158,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions-ecosystem/action-get-latest-tag@v1 - id: latest-tag - with: - semver_only: true - initial_version: 0.0.1 + - uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -172,5 +170,4 @@ jobs: with: push: true # Will only build if this is not here tags: | - ghcr.io/${{ github.repository }}:${{ steps.latest-tag.outputs.tag }} - ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}