Skip to content

Commit 8d9d8b3

Browse files
authored
fix(ci): trigger docker image publish on release (#3687)
1 parent 2ddd0a5 commit 8d9d8b3

2 files changed

Lines changed: 33 additions & 8 deletions

File tree

.github/workflows/docker-publish.yaml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Publish Docker Image
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
workflow_run:
5+
workflows: ["Publish Release"]
6+
types: [completed]
77

88
permissions:
99
contents: read
@@ -12,6 +12,10 @@ permissions:
1212
jobs:
1313
docker:
1414
runs-on: ubuntu-latest
15+
if: |
16+
github.event.workflow_run.head_repository.full_name == github.repository &&
17+
github.event.workflow_run.conclusion == 'success' &&
18+
startsWith(github.event.workflow_run.head_branch, 'release/v')
1519
steps:
1620
- name: Checkout repository
1721
uses: actions/checkout@v7
@@ -20,7 +24,28 @@ jobs:
2024

2125
- name: Extract version
2226
id: version
23-
run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
27+
env:
28+
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
29+
run: |
30+
VERSION="${HEAD_BRANCH#release/v}"
31+
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
32+
echo "Could not extract a valid version from branch '$HEAD_BRANCH'" >&2
33+
exit 1
34+
fi
35+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
36+
37+
- name: Wait for npm package
38+
env:
39+
VERSION: ${{ steps.version.outputs.version }}
40+
run: |
41+
for i in $(seq 1 30); do
42+
if npm view "orval@${VERSION}" version > /dev/null 2>&1; then
43+
exit 0
44+
fi
45+
echo "orval@${VERSION} not yet on npm, retrying..."
46+
sleep 10
47+
done
48+
echo "Package never appeared on npm" && exit 1
2449
2550
- name: Set up QEMU
2651
uses: docker/setup-qemu-action@v4
@@ -44,5 +69,5 @@ jobs:
4469
build-args: |
4570
ORVAL_VERSION=${{ steps.version.outputs.version }}
4671
tags: |
47-
ghcr.io/orval-labs/orval:${{ steps.version.outputs.version }}
48-
ghcr.io/orval-labs/orval:latest
72+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
73+
ghcr.io/${{ github.repository }}:latest

docs/content/docs/installation.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ docker run --rm -v "${PWD}:/app" -w /app ghcr.io/orval-labs/orval
6161
</Tab>
6262
</Tabs>
6363

64-
Pin a specific release with a version tag (for example `8.19.0`):
64+
Pin a specific release with a version tag (for example `8.21.0`):
6565

6666
```bash
67-
ghcr.io/orval-labs/orval:8.19.0
67+
ghcr.io/orval-labs/orval:8.21.0
6868
```
6969

7070
### With a config file

0 commit comments

Comments
 (0)