Skip to content

Commit

Permalink
feat: publish containers on add-tag
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Jan 4, 2025
1 parent 2ce5379 commit d29f8f4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/add-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
- name: Create tag
run: |
git tag ${{ github.event.client_payload.tag }}
git push --tags
git push origin ${{ github.event.client_payload.tag }}
env:
GITHUB_TOKEN: ${{ secrets.TEBAKO_CI_PAT_TOKEN }}

- name: Set output
id: set_output
run: echo "::set-output name=tag::v${{ github.event.client_payload.tag }}"
23 changes: 20 additions & 3 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Get latest tag
if: github.event_name == 'workflow_run'
id: get_latest_tag
uses: actions/github-script@v7
with:
script: |
const latestTag = await github.repos.listTags({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1
});
core.setOutput('latest_tag', latestTag.data[0].name);
- name: Set GITHUB_REF
if: github.event_name == 'workflow_run'
run: echo "GITHUB_REF=refs/tags/${{ steps.get_latest_tag.outputs.latest_tag }}" >> $GITHUB_ENV

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -66,7 +83,7 @@ jobs:
with:
context: .
file: ./${{ matrix.container }}.Dockerfile
push: ${{ contains(github.ref, 'refs/tags/v') }}
push: ${{ contains(github.ref, 'refs/tags/v') || github.event_name == 'workflow_run' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Expand All @@ -82,7 +99,7 @@ jobs:

test-packaging-in-container:
name: Package ${{ matrix.gem }} in ${{ matrix.container }} with Ruby ${{ matrix.package_ruby_ver }}
if: contains(github.ref, 'refs/tags/v')
if: contains(github.ref, 'refs/tags/v') || github.event_name == 'workflow_run'
runs-on: ubuntu-20.04
needs: build-amd64-containers
strategy:
Expand Down Expand Up @@ -114,7 +131,7 @@ jobs:

test-packaging-by-container:
name: Package ${{ matrix.gem }} by ${{ matrix.container }} container with Ruby ${{ matrix.package_ruby_ver }}
if: contains(github.ref, 'refs/tags/v')
if: contains(github.ref, 'refs/tags/v') || github.event_name == 'workflow_run'
runs-on: ubuntu-20.04
needs: build-amd64-containers
strategy:
Expand Down

0 comments on commit d29f8f4

Please sign in to comment.