-
Notifications
You must be signed in to change notification settings - Fork 9
72 lines (67 loc) · 2.35 KB
/
release.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
# This workflows will build, test and upload the package to npm when a release
# is created.
# To create a release, please follow the steps documented in the "Build &
# Publish" section of the README.md file.
name: Upload Package
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
permissions:
contents: write
jobs:
test:
uses: ./.github/workflows/end-to-end-tests.yml
secrets: inherit
publish:
runs-on: ubuntu-20.04
needs: test
steps:
- uses: actions/checkout@v4
- name: Stop early if the tag fails any validation
run: sh validate-version.sh ${{ github.ref_name }}
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
scope: "@readalongs"
- run: npm install
- run: npx update-browserslist-db@latest
- name: Build and bundle
run: |
npx nx build web-component
npx nx bundle web-component
npx nx build ngx-web-component
- name: Fix the relative URLs in the READMEs to work on npmjs
run: |
sed -i 's/(\.\.\/web-component)/(web-component)/g' dist/packages/ngx-web-component/README.md
sed -i 's/(test-data\//(https:\/\/github.com\/ReadAlongs\/Studio-Web\/blob\/${{ github.ref_name }}\/packages\/web-component\/test-data\//g' dist/packages/web-component/README.md
- name: Publish web-component to npmjs
run: |
cd dist/packages/web-component && npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish ngx-web-component to npmjs
run: |
cd dist/packages/ngx-web-component && npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
deploy:
needs: publish
uses: ./.github/workflows/deploy.yml
secrets: inherit