Skip to content

Commit cb8efbd

Browse files
authored
build: Add publishing workflows (#8)
* build: Add publishing workflows * Remove tag trigger for publish workflow
1 parent 8e8ec3b commit cb8efbd

4 files changed

Lines changed: 96 additions & 0 deletions

File tree

.github/release-please-config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"release-type": "node",
6+
"changelog-path": "CHANGELOG.md"
7+
}
8+
}
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.0"
3+
}

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish @doist/react-compiler-tracker package
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
packages: write
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Prepare Node.js environment for GitHub Packages registry
20+
uses: actions/setup-node@v6
21+
with:
22+
cache: npm
23+
node-version-file: .node-version
24+
registry-url: https://npm.pkg.github.com/
25+
scope: '@doist'
26+
27+
- name: Ensure npm 11.5.1 or later is installed
28+
run: npm install -g npm@latest
29+
30+
- name: Install project npm dependencies
31+
run: npm ci
32+
33+
- run: npm run check
34+
- run: npm run test
35+
- run: npm run build
36+
37+
- name: Publish package to GitHub Packages registry
38+
run: npm publish
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
actions: write
12+
13+
jobs:
14+
release-please:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: googleapis/release-please-action@v4
18+
id: release
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
target-branch: main
22+
config-file: .github/release-please-config.json
23+
manifest-file: .github/release-please-manifest.json
24+
25+
- name: Trigger deployment workflows
26+
if: ${{ steps.release.outputs.release_created }}
27+
uses: actions/github-script@v7
28+
with:
29+
script: |
30+
const repo = context.repo.repo;
31+
const owner = context.repo.owner;
32+
33+
async function triggerWorkflow(workflow_id) {
34+
console.log(`Triggering workflow: ${workflow_id}`);
35+
await github.rest.actions.createWorkflowDispatch({
36+
owner: owner,
37+
repo: repo,
38+
workflow_id: workflow_id,
39+
ref: 'main'
40+
});
41+
console.log(`Successfully triggered ${workflow_id}`);
42+
}
43+
44+
await triggerWorkflow('publish.yml');

0 commit comments

Comments
 (0)