Skip to content

Commit 922a212

Browse files
ci: export version number from semantic release
1 parent 05f996d commit 922a212

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
runs-on: ubuntu-latest
5454
outputs:
5555
release-status: ${{ env.release_status }}
56+
release-version: ${{ env.release_version }}
5657
# Release only where secrets are available.
5758
if: >-
5859
!github.event.repository.fork
@@ -80,7 +81,7 @@ jobs:
8081
needs:
8182
- release
8283
runs-on: ubuntu-latest
83-
if: needs.release.outputs.release-status == released
84+
if: needs.release.outputs.release-status == 'released'
8485
env:
8586
REGISTRY: ghcr.io
8687
IMAGE_NAME: ${{ github.repository }}
@@ -96,20 +97,20 @@ jobs:
9697
registry: ${{ env.REGISTRY }}
9798
username: ${{ github.actor }}
9899
password: ${{ secrets.GITHUB_TOKEN }}
99-
- id: version
100-
run: echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
100+
- id: full-image-name
101+
run: echo "image-name=${ env.REGISTRY,, }/${ env.IMAGE_NAME,, }" >> $GITHUB_OUTPUT
101102
- name: Build and push the image to GitHub Container registry
102-
uses: docker/build-push-action@3.3.0
103+
uses: docker/build-push-action@v3.3.0
103104
with:
104105
context: .
105106
push: true
106-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
107+
tags: ${{ steps.full-image-name.outputs.image-name }}:latest, ${{ steps.full-image-name.outputs.image-name }}:${{ needs.release.outputs.release-version }}
107108
documentation-deploy:
108109
needs:
109110
- release
110111
runs-on: ubuntu-latest
111112
# Update documentation only when there is a new release
112-
if: needs.release.outputs.release-status == released
113+
if: needs.release.outputs.release-status == 'released'
113114
steps:
114115
- name: Checkout the repository
115116
uses: actions/checkout@v3

release.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const publishCommands = `
99
git tag -a -f \${nextRelease.version} \${nextRelease.version} -F CHANGELOG.md || exit 2
1010
git push --force origin \${nextRelease.version} || exit 3
1111
echo "release_status=released" >> $GITHUB_ENV
12+
echo "release_version=${nextRelease.version}" >> $GITHUB_ENV
1213
`
1314
// Only release on branch main
1415
const releaseBranches = ["main"]

0 commit comments

Comments
 (0)