-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
63 lines (61 loc) · 1.76 KB
/
publish.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
name: Publish
on:
push:
branches:
- master
paths:
- 'entries/**'
- 'img/**'
concurrency:
group: 'publish'
cancel-in-progress: true
jobs:
publish:
name: Build and Publish files
if: github.repository == '2factorauth/twofactorauth'
permissions:
pages: write
id-token: write
environment: production
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '3.0'
- name: Generate API files
run: |
mkdir -p api/v3
./scripts/APIv3.rb
- name: Publish changes to Algolia
run: bundle exec ruby ./scripts/Algolia.rb
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_INDEX_NAME: ${{ vars.ALGOLIA_INDEX_NAME }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
- uses: crazy-max/ghaction-import-gpg@v5
id: pgp
with:
gpg_private_key: ${{ secrets.PGP_KEY }}
passphrase: ${{ secrets.PGP_PASSWORD }}
- name: Sign API files
run: bundle exec ruby scripts/Sign.rb
env:
PGP_PASSWORD: ${{ secrets.PGP_PASSWORD }}
PGP_KEY_ID: ${{ steps.pgp.outputs.keyid }}
- name: Prepare publish directory
run: |
mkdir -p public/icons
cp -r api/. public/
cp -r img/. public/icons/
cp robots.txt public/
- uses: actions/upload-pages-artifact@v1
with:
path: public/
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v1
- name: Send webhook to Cloudflare
run: curl -X POST -IL "${{ secrets.WEBHOOK }}" -o /dev/null -w '%{http_code}\n' -s