File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 release-docker-image :
1414 name : Build and Release powersync-service Docker Image
1515 runs-on : ubuntu-latest
16+ environment : dockerhub
1617 steps :
1718 - name : Checkout
1819 uses : actions/checkout@v5
@@ -51,11 +52,31 @@ jobs:
5152 pnpm changeset status
5253 pnpm changeset version --snapshot dev
5354
54- # This uses the service's package.json version for the Docker Image tag
55- # The changeset command above should change this to a dev package
56- - name : Get Service Version from package.json
55+ # This uses the service's package.json version for the Docker Image tag.
56+ # The changeset command above must change this to a dev package version.
57+ - name : Get dev service version from package.json
5758 id : get_version
58- run : echo "SERVICE_VERSION=$(node -p "require('./service/package.json').version")" >> $GITHUB_OUTPUT
59+ run : |
60+ version="$(node -p "require('./service/package.json').version")"
61+
62+ node -e '
63+ const semver = require("semver");
64+ const version = process.argv[1];
65+ const parsed = semver.parse(version);
66+
67+ if (!parsed) {
68+ console.error("Service version " + version + " is not a valid semver version.");
69+ process.exit(1);
70+ }
71+
72+ const prerelease = parsed.prerelease.join(".");
73+ if (!/^dev(?:[.-]|$)/.test(prerelease)) {
74+ console.error("Service version " + version + " is not a dev snapshot version.");
75+ process.exit(1);
76+ }
77+ ' "$version"
78+
79+ echo "SERVICE_VERSION=$version" >> "$GITHUB_OUTPUT"
5980
6081 - name : Extract metadata for the image
6182 uses : docker/metadata-action@v5
Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ jobs:
2424 - name : Validate release tag
2525 id : version
2626 run : |
27- if [ "${{ github.ref_type }} " != "tag" ]; then
27+ if [ "$GITHUB_REF_TYPE " != "tag" ]; then
2828 echo "This workflow must be run against a git tag, e.g. gh workflow run docker-next --ref v1.21.0" >&2
2929 exit 1
3030 fi
3131
3232 version="$(node -p "require('./service/package.json').version")"
33- tag="${{ github.ref_name }} "
33+ tag="$GITHUB_REF_NAME "
3434
3535 if [ "$tag" != "v$version" ]; then
3636 echo "Git tag $tag does not match service package version $version" >&2
Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ jobs:
2424 - name : Validate release tag
2525 id : version
2626 run : |
27- if [ "${{ github.ref_type }} " != "tag" ]; then
27+ if [ "$GITHUB_REF_TYPE " != "tag" ]; then
2828 echo "This workflow must be run against a git tag, e.g. gh workflow run docker-stable --ref v1.21.0" >&2
2929 exit 1
3030 fi
3131
3232 version="$(node -p "require('./service/package.json').version")"
33- tag="${{ github.ref_name }} "
33+ tag="$GITHUB_REF_NAME "
3434
3535 if [ "$tag" != "v$version" ]; then
3636 echo "Git tag $tag does not match service package version $version" >&2
Original file line number Diff line number Diff line change 6060 - name : Test Build Docker Image
6161 uses : docker/build-push-action@v5
6262 with :
63- cache-from : type=registry,ref=stevenontong/${{vars.DOCKER_REGISTRY}}:cache
6463 context : .
6564 platforms : linux/amd64
6665 push : false
You can’t perform that action at this time.
0 commit comments