Skip to content

Commit

Permalink
replace manual generated tag id with trunkver
Browse files Browse the repository at this point in the history
  • Loading branch information
scottaubrey committed Oct 24, 2024
1 parent d05c362 commit 73c4dcf
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ on:
- master

jobs:
generate-version:
runs-on: ubuntu-latest
outputs:
trunkver: ${{ steps.trunkver.outputs.trunkver }}
steps:
- name: Get a version tag
id: trunkver
uses: crftd-tech/trunkver@main
with:
prerelease: ${{ github.ref == 'refs/heads/master' && 'false' || 'true' }}
tests:
runs-on: ubuntu-latest
steps:
Expand All @@ -25,16 +35,13 @@ jobs:
run: docker compose exec app bash ./project_tests.sh
- name: Smoke Tests
run: docker compose exec app bash ./smoke_tests.sh
- name: Take down test stack
if: always()
run: docker compose down
build-and-push:
needs: [tests]
needs: [generate-version, tests]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
env:
IMAGE_REPO: ghcr.io/elifesciences/api-dummy
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
IMAGE_TAG: ${{ github.ref == 'refs/heads/master' && needs.generate-version.outputs.trunkver || format('{0}-{1}', github.head_ref || github.ref_name, needs.generate-version.outputs.trunkver) }}
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
Expand All @@ -47,12 +54,6 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get current date
id: date
run: echo "date=$(date --utc +%Y%m%d.%H%M)" >> $GITHUB_OUTPUT
- name: Get sha with 8 chars long
id: commit_sha
run: echo "commit_sha=${GITHUB_SHA:0:8}" >> $GITHUB_OUTPUT
- name: Build and push client image
uses: docker/build-push-action@v6
with:
Expand All @@ -63,4 +64,4 @@ jobs:
target: prod
tags: |
${{ env.IMAGE_REPO }}:${{ github.sha }}
${{ env.IMAGE_REPO }}:${{ env.BRANCH_NAME }}-${{ steps.commit_sha.outputs.commit_sha }}-${{ steps.date.outputs.date }}
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}

0 comments on commit 73c4dcf

Please sign in to comment.