-
-
Notifications
You must be signed in to change notification settings - Fork 35
77 lines (72 loc) · 2.2 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
67
68
69
70
71
72
73
74
75
76
77
name: "Publish package and docs"
on: [push]
permissions:
contents: write
pages: write
id-token: write
env:
AURI_GITHUB_TOKEN: ${{secrets.AURI_GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
jobs:
publish-package:
name: Publish package
runs-on: ubuntu-latest
outputs:
changesets: ${{steps.check-changesets.outputs.changesets}}
steps:
- name: Setup actions
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: "https://registry.npmjs.org/"
- name: Install Auri
run: npm install -g [email protected]
- name: Prepare release
run: npx auri prepare ${{ github.ref_name }}
- name: Publish package
run: npx auri publish ${{ github.ref_name }}
check-changesets:
name: Check changesets
needs: publish-package
runs-on: ubuntu-latest
outputs:
changesets: ${{steps.check-changesets.outputs.changesets}}
steps:
- name: Check if ".changesets" directory has files
id: check-changesets
run: |
if [ -z "$(ls -A .changesets)" ]; then
echo "changesets=0" >> "$GITHUB_OUTPUT"
else
echo "changesets=1" >> "$GITHUB_OUTPUT"
fi
publish-docs:
name: Publish docs
needs: check-changesets
if: needs.check-changesets.check-changesets.outputs.changesets == 0 && github.ref_name == 'main'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Set up actions
uses: actions/checkout@v3
- name: Install malta
working-directory: docs
run: |
curl -o malta.tgz -L https://github.com/pilcrowonpaper/malta/releases/latest/download/linux-amd64.tgz
tar -xvzf malta.tgz
- name: build
working-directory: docs
run: ./linux-amd64/malta build
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: "docs/dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1