-
Notifications
You must be signed in to change notification settings - Fork 18
92 lines (80 loc) · 2.79 KB
/
publish-packages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Publish Packages
on: [workflow_dispatch]
permissions:
contents: write
jobs:
validate:
uses: ./.github/workflows/validate.yml
publish:
name: Publish
needs: [validate]
strategy:
max-parallel: 1
matrix:
package:
- fake-browser
- messaging
- storage
- proxy-service
- isolated-element
- job-scheduler
- match-patterns
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Pull Latest Releases
run: git pull
- uses: actions/setup-node@v3
- uses: oven-sh/setup-bun@v2
- run: bun install
- id: changelog
name: Generate changelog
uses: aklinker1/generate-changelog/.github/actions/generate-changelog@main
with:
module: ${{ matrix.package }}
scopes: ${{ matrix.package }}
changeTemplate: '- {{ message }} ({{ commit.hash }})'
- name: Bump Version
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
node -p -e "
const pkg = JSON.parse(\`$(cat package.json)\`);
pkg.version = '${{ steps.changelog.outputs.nextVersion }}';
JSON.stringify(pkg, null, 2);
" > package.json
echo "Updated package.json:"
cat package.json
git config --global user.email "[email protected]"
git config --global user.name "Changelog Action"
git add package.json
git commit -m "chore(release): ${{ matrix.package }}-v${{ steps.changelog.outputs.nextVersion }}"
git push
working-directory: packages/${{ matrix.package }}
- name: Create Tag
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
git tag "${{ matrix.package }}-v${{ steps.changelog.outputs.nextVersion }}"
git push --tags
- id: create_release
name: Create GitHub Release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
tag_name: ${{ matrix.package }}-v${{ steps.changelog.outputs.nextVersion }}
release_name: '@webext-core/${{ matrix.package }} v${{ steps.changelog.outputs.nextVersion }}'
body: ${{ steps.changelog.outputs.changelog }}
- name: Publish to NPM
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/.npmrc
bun run build
bun publish
working-directory: packages/${{ matrix.package }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}