Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions .github/workflows/docker-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
release-docker-image:
name: Build and Release powersync-service Docker Image
runs-on: ubuntu-latest
environment: dockerhub
steps:
- name: Checkout
uses: actions/checkout@v5
Expand Down Expand Up @@ -51,11 +52,31 @@ jobs:
pnpm changeset status
pnpm changeset version --snapshot dev

# This uses the service's package.json version for the Docker Image tag
# The changeset command above should change this to a dev package
- name: Get Service Version from package.json
# This uses the service's package.json version for the Docker Image tag.
# The changeset command above must change this to a dev package version.
- name: Get dev service version from package.json
id: get_version
run: echo "SERVICE_VERSION=$(node -p "require('./service/package.json').version")" >> $GITHUB_OUTPUT
run: |
version="$(node -p "require('./service/package.json').version")"

node -e '
const semver = require("semver");
const version = process.argv[1];
const parsed = semver.parse(version);

if (!parsed) {
console.error("Service version " + version + " is not a valid semver version.");
process.exit(1);
}

const prerelease = parsed.prerelease.join(".");
if (!/^dev(?:[.-]|$)/.test(prerelease)) {
console.error("Service version " + version + " is not a dev snapshot version.");
process.exit(1);
}
' "$version"

echo "SERVICE_VERSION=$version" >> "$GITHUB_OUTPUT"

- name: Extract metadata for the image
uses: docker/metadata-action@v5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
- name: Validate release tag
id: version
run: |
if [ "${{ github.ref_type }}" != "tag" ]; then
if [ "$GITHUB_REF_TYPE" != "tag" ]; then
echo "This workflow must be run against a git tag, e.g. gh workflow run docker-next --ref v1.21.0" >&2
exit 1
fi

version="$(node -p "require('./service/package.json').version")"
tag="${{ github.ref_name }}"
tag="$GITHUB_REF_NAME"

if [ "$tag" != "v$version" ]; then
echo "Git tag $tag does not match service package version $version" >&2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
- name: Validate release tag
id: version
run: |
if [ "${{ github.ref_type }}" != "tag" ]; then
if [ "$GITHUB_REF_TYPE" != "tag" ]; then
echo "This workflow must be run against a git tag, e.g. gh workflow run docker-stable --ref v1.21.0" >&2
exit 1
fi

version="$(node -p "require('./service/package.json').version")"
tag="${{ github.ref_name }}"
tag="$GITHUB_REF_NAME"

if [ "$tag" != "v$version" ]; then
echo "Git tag $tag does not match service package version $version" >&2
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ jobs:
- name: Test Build Docker Image
uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=stevenontong/${{vars.DOCKER_REGISTRY}}:cache
Comment thread
rkistner marked this conversation as resolved.
context: .
platforms: linux/amd64
push: false
Expand Down
Loading