Skip to content

Commit 5ed9a90

Browse files
authored
Merge pull request #48 from aspiers/update-release-workflows
2 parents d28e27b + 71765ee commit 5ed9a90

12 files changed

+1618
-257
lines changed

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "hypercerts-org/hypercerts-lexicon" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [],
10+
"access": "public",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": []
14+
}

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10

.github/workflows/create-prerelease-lexicon.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/create-release-lexicon.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/dryrun-release-ci-lexicon.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/pr-check.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: PR Check
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
changeset-check:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
cache: "npm"
18+
- run: npm ci
19+
- name: Check for changeset
20+
run: |
21+
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^lexicons/\|^types/\|^package.json"; then
22+
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^\.changeset/.*\.md$"; then
23+
echo "Changeset found"
24+
else
25+
echo "::warning::No changeset found. Run 'npm run changeset' if this PR includes user-facing changes."
26+
fi
27+
else
28+
echo "No package changes detected"
29+
fi

.github/workflows/release-beta.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Release Beta
2+
3+
on:
4+
workflow_dispatch:
5+
# SDK uses automatic triggers on develop branch, but for now
6+
# we'll manually trigger.
7+
# push:
8+
# branches: [main]
9+
10+
concurrency: ${{ github.workflow }}-${{ github.ref }}
11+
12+
jobs:
13+
release-beta:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
id-token: write
18+
19+
steps:
20+
- name: Check RELEASE_PAT secret exists
21+
run: |
22+
if [ -z "${{ secrets.RELEASE_PAT }}" ]; then
23+
echo "Error: RELEASE_PAT secret is required but not set"
24+
echo "This workflow requires a Personal Access Token to bypass branch protection rules"
25+
exit 1
26+
fi
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
# Use PAT to bypass branch protection rules when committing and pushing
31+
token: ${{ secrets.RELEASE_PAT }}
32+
# Branch check is necessary for manual triggers (workflow_dispatch) to ensure
33+
# we only push version changes to main. If using automatic push triggers,
34+
# the trigger itself would enforce the branch, but manual triggers can run
35+
# from any branch.
36+
- name: Check branch is main
37+
run: |
38+
if [ "${{ github.ref }}" != "refs/heads/main" ]; then
39+
echo "Error: This workflow must be run on the main branch"
40+
exit 1
41+
fi
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: 20
45+
cache: "npm"
46+
registry-url: "https://registry.npmjs.org"
47+
- run: npm ci
48+
- run: npm run check
49+
50+
- name: Enter prerelease mode (if not already)
51+
run: |
52+
if [ ! -f .changeset/pre.json ]; then
53+
npx changeset pre enter beta
54+
git config user.name "github-actions[bot]"
55+
git config user.email "github-actions[bot]@users.noreply.github.com"
56+
git add .changeset/pre.json
57+
git commit -m "chore: enter beta prerelease mode"
58+
fi
59+
60+
- name: Version packages
61+
run: npm run version-packages
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- name: Create .npmrc
66+
run: |
67+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
68+
echo "@hypercerts-org:registry=https://registry.npmjs.org/" >> .npmrc
69+
70+
- name: Publish beta packages
71+
# Use npm run release to match regular releases - it runs check before publishing
72+
# to ensure validation after versioning (package.json/changelog changes)
73+
run: npm run release
74+
env:
75+
NPM_CONFIG_PROVENANCE: true
76+
77+
- name: Commit and push version changes
78+
run: |
79+
git config user.name "github-actions[bot]"
80+
git config user.email "github-actions[bot]@users.noreply.github.com"
81+
git add -A
82+
git diff --staged --quiet || git commit -m "chore: version packages (beta)"
83+
git push

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency: ${{ github.workflow }}-${{ github.ref }}
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
id-token: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: "npm"
24+
registry-url: "https://registry.npmjs.org"
25+
- run: npm ci
26+
- run: npm run check
27+
28+
- name: Create .npmrc
29+
run: |
30+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
31+
echo "@hypercerts-org:registry=https://registry.npmjs.org/" >> .npmrc
32+
33+
- name: Create Release Pull Request or Publish
34+
id: changesets
35+
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
36+
with:
37+
publish: npm run release
38+
version: npm run version-packages
39+
title: "chore: release packages"
40+
commit: "chore: release packages"
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
NPM_CONFIG_PROVENANCE: true
44+
45+
- name: Log published packages
46+
if: steps.changesets.outputs.published == 'true'
47+
run: echo "Published - ${{ steps.changesets.outputs.publishedPackages }}"

.releaserc.prerelease.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)