-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (66 loc) · 1.87 KB
/
publish.yaml
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
name: Publish package to npmjs
on:
push:
branches: [main]
env:
BASE: slidev-addon-asciinema
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
- name: Configure git credentials
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "Github Actions"
- run: yarn version --patch
- run: yarn
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push commits and tags
run: git push --follow-tags # `yarn` already commits and tags
- name: Get latest tag (added by yarn)
run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Create release
uses: actions/github-script@v6
with:
script: |
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "${{ env.TAG }}",
generate_release_notes: true
})
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build --base ${{ env.BASE }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: dist/
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2