Skip to content

Commit bf73da0

Browse files
authored
feat(release): Swap to release-please (#934)
## What does this do? Swaps us from `semantic-release` to `release-please` ## How was it tested? This is the test. ## Here's a fun image for your troubles <img width="610" height="561" alt="image" src="https://github.com/user-attachments/assets/a13cc01d-e621-4bfb-9a19-40cb02597a37" />
1 parent 272e134 commit bf73da0

File tree

6 files changed

+127
-129
lines changed

6 files changed

+127
-129
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
1+
# This workflow handles CI tasks: linting, testing, and deployment
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: 5e Database CI/CD
4+
name: CI
55

66
on:
77
push:
88
branches: [main]
9-
tags:
10-
- 'v*'
119
pull_request:
1210
branches: [main]
1311

@@ -43,104 +41,3 @@ jobs:
4341
run: npm ci
4442
- name: Run tests
4543
run: npm run test
46-
47-
deploy:
48-
name: Deploy Changes (Update Database)
49-
runs-on: ubuntu-latest
50-
needs: [test, lint]
51-
if: ${{ github.event_name != 'pull_request' && github.repository == '5e-bits/5e-database' }}
52-
steps:
53-
- name: Checkout repository
54-
uses: actions/checkout@v5
55-
with:
56-
fetch-depth: 2
57-
- name: Set up Node.js 22.x
58-
uses: actions/setup-node@v6
59-
with:
60-
node-version: 22.x
61-
cache: 'npm'
62-
- name: Install dependencies
63-
run: npm ci
64-
- name: Run Database Update Script
65-
env:
66-
MONGODB_URI: ${{ secrets.MONGODB_URI }}
67-
run: npm run db:update
68-
69-
github-release:
70-
name: Create Github Release
71-
runs-on: ubuntu-latest
72-
needs: [deploy]
73-
if: ${{ github.event_name != 'pull_request' && github.repository == '5e-bits/5e-database' }}
74-
outputs:
75-
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
76-
version: ${{ steps.semantic.outputs.new_release_version }}
77-
permissions:
78-
contents: write
79-
steps:
80-
- name: Generate GitHub App Token
81-
id: generate_token
82-
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # Use a specific version
83-
with:
84-
# These secrets will be resolved from Org or Repo level
85-
app_id: ${{ secrets.SEMANTIC_RELEASE_APP_ID }}
86-
private_key: ${{ secrets.SEMANTIC_RELEASE_APP_PRIVATE_KEY }}
87-
- name: Checkout latest code
88-
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # @v4.2.2
89-
with:
90-
fetch-depth: 0
91-
token: ${{ steps.generate_token.outputs.token }}
92-
- name: Install Dependencies
93-
run: npm ci
94-
- name: Semantic Release
95-
id: semantic
96-
uses: cycjimmy/semantic-release-action@ba330626c4750c19d8299de843f05c7aa5574f62 # @v5.0.2
97-
env:
98-
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
99-
100-
container-release:
101-
name: Container Release
102-
runs-on: ubuntu-latest
103-
needs: [github-release]
104-
if: ${{ needs.github-release.outputs.new_release_published == 'true' && github.repository == '5e-bits/5e-database' }}
105-
env:
106-
REGISTRY: ghcr.io
107-
IMAGE_NAME: ${{ github.repository }}
108-
permissions:
109-
contents: read
110-
packages: write
111-
steps:
112-
- name: Checkout repository
113-
uses: actions/checkout@v5
114-
- name: Log in to the Container registry
115-
uses: docker/login-action@v3
116-
with:
117-
registry: ${{ env.REGISTRY }}
118-
username: ${{ github.actor }}
119-
password: ${{ secrets.GITHUB_TOKEN }}
120-
- name: Build and push Docker image
121-
uses: docker/build-push-action@v6
122-
with:
123-
context: .
124-
push: ${{ github.event_name != 'pull_request' }}
125-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.github-release.outputs.version }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
126-
labels: version=${{ needs.github-release.outputs.version }}
127-
128-
trigger_downstream:
129-
name: Trigger downstream
130-
runs-on: ubuntu-latest
131-
needs: deploy
132-
if: ${{ github.ref == 'refs/heads/main' && github.repository == '5e-bits/5e-database' }}
133-
steps:
134-
- name: Generate GitHub App Token
135-
id: generate_token
136-
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # Use a specific version
137-
with:
138-
# These secrets will be resolved from Org or Repo level
139-
app_id: ${{ secrets.DEPLOYMENT_APP_ID }}
140-
private_key: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }}
141-
- name: Trigger downstream
142-
uses: peter-evans/repository-dispatch@v4
143-
with:
144-
token: ${{ steps.generate_token.outputs.token }}
145-
repository: 5e-bits/5e-srd-api
146-
event-type: build_application
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
version: ${{ steps.release.outputs.version }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
with:
22+
fetch-depth: 0
23+
- name: Release Please
24+
id: release
25+
uses: google-github-actions/release-please-action@v4
26+
with:
27+
release-type: node
28+
config-file: release-please-config.json

.github/workflows/release.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
name: Deploy Changes (Update Database)
11+
runs-on: ubuntu-latest
12+
if: ${{ github.repository == '5e-bits/5e-database' }}
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v5
16+
with:
17+
fetch-depth: 2
18+
- name: Set up Node.js 22.x
19+
uses: actions/setup-node@v6
20+
with:
21+
node-version: 22.x
22+
cache: 'npm'
23+
- name: Install dependencies
24+
run: npm ci
25+
- name: Run Database Update Script
26+
env:
27+
MONGODB_URI: ${{ secrets.MONGODB_URI }}
28+
run: npm run db:update
29+
30+
container-release:
31+
name: Container Release
32+
runs-on: ubuntu-latest
33+
needs: [deploy]
34+
if: ${{ github.repository == '5e-bits/5e-database' }}
35+
env:
36+
REGISTRY: ghcr.io
37+
IMAGE_NAME: ${{ github.repository }}
38+
permissions:
39+
contents: read
40+
packages: write
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v5
44+
with:
45+
fetch-depth: 0
46+
- name: Get version from package.json
47+
id: version
48+
run: |
49+
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
50+
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
51+
elif [ "${{ github.event_name }}" = "release" ]; then
52+
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
53+
else
54+
VERSION=$(node -p "require('./package.json').version")
55+
echo "version=$VERSION" >> $GITHUB_OUTPUT
56+
fi
57+
- name: Log in to the Container registry
58+
uses: docker/login-action@v3
59+
with:
60+
registry: ${{ env.REGISTRY }}
61+
username: ${{ github.actor }}
62+
password: ${{ secrets.GITHUB_TOKEN }}
63+
- name: Build and push Docker image
64+
uses: docker/build-push-action@v6
65+
with:
66+
context: .
67+
push: true
68+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
69+
labels: version=${{ steps.version.outputs.version }}
70+
71+
trigger-downstream:
72+
name: Trigger Downstream
73+
runs-on: ubuntu-latest
74+
needs: [deploy, container-release]
75+
if: ${{ github.repository == '5e-bits/5e-database' }}
76+
steps:
77+
- name: Generate GitHub App Token
78+
id: generate_token
79+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
80+
with:
81+
app_id: ${{ secrets.DEPLOYMENT_APP_ID }}
82+
private_key: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }}
83+
- name: Trigger downstream
84+
uses: peter-evans/repository-dispatch@v4
85+
with:
86+
token: ${{ steps.generate_token.outputs.token }}
87+
repository: 5e-bits/5e-srd-api
88+
event-type: build_application

.releaserc.json

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

package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525
},
2626
"homepage": "https://github.com/5e-bits/5e-database#readme",
2727
"devDependencies": {
28-
"@semantic-release/changelog": "^6.0.3",
29-
"@semantic-release/commit-analyzer": "^13.0.1",
30-
"@semantic-release/git": "^10.0.1",
31-
"@semantic-release/github": "^12.0.0",
32-
"@semantic-release/npm": "^12.0.2",
33-
"@semantic-release/release-notes-generator": "^14.1.0",
3428
"@types/deep-diff": "^1.0.5",
3529
"@types/mongodb": "^4.0.7",
3630
"@types/node": "^24.8.1",
@@ -42,7 +36,6 @@
4236
"jsdom": "^27.0.1",
4337
"mongodb": "^6.20.0",
4438
"redis": "^5.8.3",
45-
"semantic-release": "^25.0.1",
4639
"typescript": "^5.9.3",
4740
"vitest": "^3.1.2"
4841
},

release-please-config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"release-type": "node",
3+
"packages": {
4+
".": {
5+
"release-type": "node",
6+
"package-name": "5e-database"
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)