-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (82 loc) · 2.69 KB
/
deploy-releases.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
name: Deploy to releases.slint.dev
on:
push:
paths: 'releases/**'
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./releases
outputs:
version: ${{ steps.identify-version.outputs.VERSION }}
steps:
- name: Repository Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
releases
- name: Identify Version
id: identify-version
run: |
version=$(sed -n '1p' versions.txt)
echo "VERSION=$version" >> "$GITHUB_OUTPUT"
- name: Copy latest release to docs
run: |
rsync -ua ${{ steps.identify-version.outputs.VERSION }} docs
cp versions.txt docs
- name: npm install
run: |
npm install
- name: Generate a token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.READ_WRITE_APP_ID }}
private-key: ${{ secrets.READ_WRITE_PRIVATE_KEY }}
repositories: website
- name: Clone website directory
uses: actions/checkout@v4
with:
repository: slint-ui/website
ref: prod
path: releases/website
token: ${{ steps.app-token.outputs.token }}
- name: Generate docs.html and 404.html
run: |
mkdir -p website/output
cd website && go run generator/generator.go -skip-agreements
- name: Copy docs.html and 404.html
run: |
cp website/output/docs.html index.html
cp website/output/docs.html docs/index.html
cp website/output/404.html 404.html
cp website/output/404.html docs/404.html
rm -rf website
- name: Install Netlify
run: |
npm install netlify-cli --save-dev
- name: Install Dependencies
run: |
npm ci
- name: Deploy to Netlify
id: netlify_deploy
run: |
netlify deploy \
--dir . \
--site ${{ secrets.NETLIFY_RELEASES_SITE_ID }} \
--auth ${{ secrets.NETLIFY_API_TOKEN }} \
--prod
- name: Set environment variables
run: |
echo "CLOUDFLARE_API_TOKEN=${{ secrets.CLOUDFLARE_API_TOKEN }}" >> $GITHUB_ENV
echo "CLOUDFLARE_ACCOUNT_ID=${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" >> $GITHUB_ENV
- name: Publish latest release to docs
run: |
cd docs && npx wrangler@3 pages deploy . --project-name=docs --commit-dirty=true
scrape-docs:
uses: ./.github/workflows/docsearch-scrape.yml
needs: build-and-deploy
with:
version: ${{ needs.build-and-deploy.outputs.version }}