Skip to content

Commit 6902071

Browse files
initial public release
1 parent 858f9b7 commit 6902071

File tree

230 files changed

+37412
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+37412
-1
lines changed

.changeset/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "origin/main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.envrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
layout node
2+
use node
3+
[ -f .env ] && dotenv
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Action to publish development Docker images
2+
# Images are versioned as `0.0.0-{tag}-DATETIMESTAMP`
3+
name: Development Image Release
4+
5+
on: workflow_dispatch
6+
7+
concurrency: ${{ github.workflow }}-${{ github.ref }}
8+
9+
jobs:
10+
release-docker-image:
11+
name: Build and Release powersync-service Docker Image
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
# check out full history
18+
# Temporarily needed for changesets
19+
fetch-depth: 0
20+
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Login to Docker Hub
28+
uses: docker/login-action@v3
29+
with:
30+
username: ${{ secrets.DOCKERHUB_USERNAME }}
31+
password: ${{ secrets.DOCKERHUB_TOKEN }}
32+
33+
- name: Setup NodeJS
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version-file: '.nvmrc'
37+
38+
- uses: pnpm/action-setup@v2
39+
name: Install pnpm
40+
with:
41+
version: 9
42+
run_install: false
43+
44+
- name: Add NPM auth
45+
run: |
46+
echo //npm.pkg.github.com/:_authToken=\${{secrets.RESTRICTED_PACKAGES_TOKEN}} >> ~/.npmrc
47+
echo "//npm.pkg.github.com/journeyapps-platform/:_authToken=${{secrets.RESTRICTED_PACKAGES_TOKEN}}" >> ~/.npmrc
48+
echo "@journeyapps-platform:registry=https://npm.pkg.github.com/journeyapps-platform/" >> ~/.npmrc
49+
50+
- name: Get pnpm store directory
51+
shell: bash
52+
run: |
53+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
54+
55+
- uses: actions/cache@v3
56+
name: Setup pnpm cache
57+
with:
58+
path: ${{ env.STORE_PATH }}
59+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
60+
restore-keys: |
61+
${{ runner.os }}-pnpm-store-
62+
63+
- name: Install dependencies
64+
run: pnpm install
65+
66+
- name: Ensure Changesets
67+
run: |
68+
# If no changesets are available the status check will fail
69+
# We should not continue if there are no changesets
70+
pnpm changeset status
71+
pnpm changeset version --no-git-tag --snapshot dev
72+
73+
# This uses the service's package.json version for the Docker Image tag
74+
# The changeset command above should change this to a dev package
75+
- name: Get Service Version from package.json
76+
id: get_version
77+
run: echo "SERVICE_VERSION=$(node -p "require('./service/package.json').version")" >> $GITHUB_OUTPUT
78+
79+
- name: Build Image and Push
80+
uses: docker/build-push-action@v5
81+
with:
82+
platforms: linux/arm64,linux/amd64
83+
cache-from: type=registry,ref=${{vars.DOCKER_REGISTRY}}:latest
84+
context: .
85+
# This should not be taged as latest
86+
tags: ${{vars.DOCKER_REGISTRY}}:${{steps.get_version.outputs.SERVICE_VERSION}}
87+
push: true
88+
file: ./service/Dockerfile
89+
# TODO remove this when removing Journey Micro
90+
build-args: |
91+
GITHUB_TOKEN=${{secrets.RESTRICTED_PACKAGES_TOKEN}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Action to publish packages under the `next` tag for testing
2+
# Packages are versioned as `0.0.0-{tag}-DATETIMESTAMP`
3+
name: Development Packages Release
4+
5+
on: workflow_dispatch
6+
7+
jobs:
8+
publish_packages:
9+
name: Publish Devevelopment Packages
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
persist-credentials: false
15+
# check out full history
16+
# Temporarily needed for changesets
17+
fetch-depth: 0
18+
19+
- name: Setup NodeJS
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version-file: '.nvmrc'
23+
24+
- uses: pnpm/action-setup@v2
25+
name: Install pnpm
26+
with:
27+
version: 9
28+
run_install: false
29+
30+
- name: Add NPM auth
31+
run: |
32+
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
33+
echo //npm.pkg.github.com/:_authToken=\${{secrets.RESTRICTED_PACKAGES_TOKEN}} >> ~/.npmrc
34+
echo "//npm.pkg.github.com/journeyapps-platform/:_authToken=${{secrets.RESTRICTED_PACKAGES_TOKEN}}" >> ~/.npmrc
35+
echo "@journeyapps-platform:registry=https://npm.pkg.github.com/journeyapps-platform/" >> ~/.npmrc
36+
37+
- name: Get pnpm store directory
38+
shell: bash
39+
run: |
40+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
41+
42+
- uses: actions/cache@v3
43+
name: Setup pnpm cache
44+
with:
45+
path: ${{ env.STORE_PATH }}
46+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pnpm-store-
49+
50+
- name: Install dependencies
51+
run: pnpm install
52+
53+
- name: Build
54+
run: pnpm build:production
55+
56+
- name: Publish
57+
run: |
58+
# If no changesets are available the status check will fail
59+
# We should not continue if there are no changesets
60+
pnpm changeset status
61+
pnpm changeset version --no-git-tag --snapshot dev
62+
pnpm changeset publish --tag dev

.github/workflows/image_release.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Publishes the Docker image to DockerHub
2+
name: Docker Image Release
3+
4+
on: workflow_dispatch
5+
6+
concurrency: ${{ github.workflow }}-${{ github.ref }}
7+
8+
jobs:
9+
release-docker-image:
10+
name: Build and Release powersync-service Docker Image
11+
runs-on: ubuntu-latest
12+
if: github.ref == 'refs/heads/main'
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
# check out full history
18+
# Temporarily needed for changesets
19+
fetch-depth: 0
20+
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Login to Docker Hub
28+
uses: docker/login-action@v3
29+
with:
30+
username: ${{ secrets.DOCKERHUB_USERNAME }}
31+
password: ${{ secrets.DOCKERHUB_TOKEN }}
32+
33+
# This uses the service's package.json version for the Docker Image tag
34+
- name: Get Service Version from package.json
35+
id: get_version
36+
run: echo "SERVICE_VERSION=$(node -p "require('./service/package.json').version")" >> $GITHUB_OUTPUT
37+
38+
- name: Build Image and Push
39+
uses: docker/build-push-action@v5
40+
with:
41+
platforms: linux/arm64,linux/amd64
42+
cache-from: type=registry,ref=${{vars.DOCKER_REGISTRY}}:latest
43+
context: .
44+
tags: ${{vars.DOCKER_REGISTRY}}:latest,${{vars.DOCKER_REGISTRY}}:${{steps.get_version.outputs.SERVICE_VERSION}}
45+
push: true
46+
file: ./service/Dockerfile
47+
# TODO remove this when removing Journey Micro
48+
build-args: |
49+
GITHUB_TOKEN=${{secrets.RESTRICTED_PACKAGES_TOKEN}}
50+
51+
# # Updates the README section on the DockerHub page
52+
- name: Update repo description
53+
# Note that this 3rd party extention is recommended in the DockerHub docs:
54+
# https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/
55+
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0
56+
with:
57+
username: ${{ secrets.DOCKERHUB_USERNAME }}
58+
password: ${{ secrets.DOCKERHUB_TOKEN }}
59+
repository: ${{vars.DOCKER_REGISTRY}}
60+
# This is the contents of what will be shown on DockerHub
61+
readme-filepath: ./service/README.md
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Packages Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release-packages:
12+
name: Release Packages
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version-file: '.nvmrc'
22+
23+
- uses: pnpm/action-setup@v2
24+
name: Install pnpm
25+
with:
26+
version: 9
27+
run_install: false
28+
29+
- name: Get pnpm store directory
30+
shell: bash
31+
run: |
32+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
33+
34+
- uses: actions/cache@v3
35+
name: Setup pnpm cache
36+
with:
37+
path: ${{ env.STORE_PATH }}
38+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39+
restore-keys: |
40+
${{ runner.os }}-pnpm-store-
41+
42+
# TODO remove this when no longer needed
43+
- name: Temporary Package Credentials
44+
run: |
45+
echo //npm.pkg.github.com/:_authToken=\${{secrets.RESTRICTED_PACKAGES_TOKEN}} >> ~/.npmrc
46+
echo "//npm.pkg.github.com/journeyapps-platform/:_authToken=${{secrets.RESTRICTED_PACKAGES_TOKEN}}" >> ~/.npmrc
47+
echo "@journeyapps-platform:registry=https://npm.pkg.github.com/journeyapps-platform/" >> ~/.npmrc
48+
49+
- name: Install dependencies
50+
run: pnpm install
51+
52+
- name: Create Release Pull Request or Publish to npm
53+
id: changesets
54+
uses: changesets/action@v1
55+
with:
56+
# This expects you to have a script called release which does a build for your packages and calls changeset publish
57+
publish: pnpm release
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)