Skip to content

Commit

Permalink
fix: Properly inject version information during build
Browse files Browse the repository at this point in the history
  • Loading branch information
nimdanitro committed Feb 7, 2024
1 parent c6d8aee commit 6643726
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ jobs:
node-version-file: ".nvmrc"
cache: yarn
cache-dependency-path: "ui/yarn.lock"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/f-eld-ch/sitrep
tags: |
# set latest tag for default branch / ordered by priority
type=semver,pattern={{version}},prefix=v,priority=920
type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'main') }},priority=910
type=raw,value=develop,enable={{is_default_branch}},priority=905
# priority 900
type=semver,pattern={{major}}.{{minor}},prefix=v
type=semver,pattern={{major}},prefix=v
# priority 700
type=edge,branch=develop
# priority 600
type=ref,event=branch
type=ref,event=pr,prefix=pr-,enable=true
- name: Install packages
run: yarn install --immutable
Expand All @@ -35,6 +53,9 @@ jobs:

- name: Build ui
run: yarn build
env:
VERSION: ${{ steps.meta.outputs.version }}
GIT_SHA: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
working-directory: ui

- uses: docker/login-action@v3
Expand All @@ -43,24 +64,6 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/f-eld-ch/sitrep
tags: |
# set latest tag for default branch / ordered by priority
type=semver,pattern={{version}},prefix=v,priority=920
type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'main') }},priority=910
type=raw,value=develop,enable={{is_default_branch}},priority=905
# priority 900
type=semver,pattern={{major}}.{{minor}},prefix=v
type=semver,pattern={{major}},prefix=v
# priority 700
type=edge,branch=develop
# priority 600
type=ref,event=branch
type=ref,event=pr,prefix=pr-,enable=true

- name: Build and push
uses: docker/build-push-action@v5
Expand Down

0 comments on commit 6643726

Please sign in to comment.