Skip to content

Commit 5561b47

Browse files
authored
fix: ensure dist folder matches release (#83)
1 parent aff753a commit 5561b47

File tree

4 files changed

+43
-14
lines changed

4 files changed

+43
-14
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
11
name: release
2+
23
on:
34
push:
45
branches:
56
- main
7+
8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
613
jobs:
714
release:
815
name: release
916
runs-on: ubuntu-latest
1017
steps:
18+
# build local version to create token
1119
- uses: actions/checkout@v4
20+
with:
21+
persist-credentials: false
22+
1223
- uses: actions/setup-node@v4
1324
with:
14-
node-version: '20'
25+
node-version-file: .node-version
26+
cache: 'npm'
27+
1528
- run: npm ci
1629
- run: npm run build
17-
- run: rm .gitignore # dist/ folder is ignored by default
18-
- run: |
19-
git config user.name github-actions
20-
git config user.email github-actions@github.com
21-
git add .gitignore dist/
22-
git commit -m "build"
23-
git push --force https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v3
24-
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
- run: npx semantic-release
30+
- uses: actions/create-github-app-token@v1
31+
id: app-token
32+
with:
33+
app-id: ${{ vars.RELEASER_APP_ID }}
34+
private-key: ${{ secrets.RELEASER_APP_PRIVATE_KEY }}
35+
# install release dependencies and release
36+
- run: npm install --no-save @semantic-release/git semantic-release-plugin-github-breaking-version-tag
37+
- run: npx semantic-release --debug
2738
env:
28-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
dist
2-
node_modules/
1+
node_modules/

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,25 @@
2929
},
3030
"release": {
3131
"branches": [
32+
"+([0-9]).x",
3233
"main"
34+
],
35+
"plugins": [
36+
"@semantic-release/commit-analyzer",
37+
"@semantic-release/release-notes-generator",
38+
"@semantic-release/github",
39+
"@semantic-release/npm",
40+
"semantic-release-plugin-github-breaking-version-tag",
41+
[
42+
"@semantic-release/git",
43+
{
44+
"assets": [
45+
"package.json",
46+
"dist/*"
47+
],
48+
"message": "build(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
49+
}
50+
]
3351
]
3452
}
3553
}

0 commit comments

Comments
 (0)