-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (119 loc) · 3.58 KB
/
main.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: test and build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
checks: write
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run test -- --ci --reporters=default --reporters=jest-junit
- uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
check_name: report
include_passed: true
report_paths: junit.xml
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci
- run: npm run build
- if: success() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: latest-lib
path: lib
- if: success() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: latest-dist
path: dist
deploy:
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v4
- uses: actions/download-artifact@v4
with:
name: latest-dist
path: dist
- uses: actions/upload-pages-artifact@v3
with:
path: dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
release:
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
outputs:
version: ${{ steps.version.outputs.latest }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
registry-url: https://registry.npmjs.org/
- uses: actions/download-artifact@v4
with:
name: latest-lib
path: lib
- run: |
git config user.email "${{ vars.NPM_EMAIL }}"
git config user.name "${{ vars.NPM_USER }}"
npm config set //registry.npmjs.org/:_authToken ${{secrets.NPM_TOKEN}}
npm install --global release-it @release-it/conventional-changelog
- run: |
release-it \
--ci \
--npm.skipChecks \
--npm.publish \
--no-github.release \
--git.commitMessage='chore: release v${version}' \
--git.pushArgs=--follow-tags \
--plugins.@release-it/conventional-changelog.infile=CHANGELOG.md \
--plugins.@release-it/conventional-changelog.header='# Astro Decap Collection' \
--plugins.@release-it/conventional-changelog.preset=angular
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: |
version=$(node -e "console.log(require('./package.json').version);")
echo "Released ${version} :rocket:" >> $GITHUB_STEP_SUMMARY