-
-
Notifications
You must be signed in to change notification settings - Fork 28
94 lines (81 loc) · 2.54 KB
/
build.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Build PDF and publish to commonhaus.github.io
on:
pull_request:
paths:
- 'bylaws/**'
- 'policies/**'
push:
paths:
- 'agreements/**'
- 'bylaws/**'
- 'policies/**'
workflow_dispatch:
env:
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GH_BOT_NAME: "GitHub Action"
PANDOCK: ghcr.io/commonhaus/pandoc-pdf:3.1
permissions:
contents: read
jobs:
main-root:
outputs:
is-main: ${{ steps.is-main-root.outputs.test }}
runs-on: ubuntu-latest
steps:
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'commonhaus/foundation'
id: is-main-root
run: echo "test=true" >> "$GITHUB_OUTPUT"
update-website:
needs: main-root
runs-on: ubuntu-latest
if: ${{ needs.main-root.outputs.is-main }}
permissions:
actions: read
steps:
- name: Bump website
env:
GH_TOKEN: ${{ secrets.ACTIONS_PUBLISH_PAT }}
run: |
gh workflow run -R commonhaus/commonhaus.github.io push-content.yml
package:
name: Package PDFs
needs: main-root
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: convert md to pdf
if: ${{ needs.main-root.outputs.is-main || github.event_name == 'pull_request' }}
env:
GIT_COMMIT: ${{ github.sha }}
GH_TOKEN: ${{ github.token }}
IS_PR: ${{ github.event_name == 'pull_request' }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: ./.github/docker-build-pdf.sh
- uses: actions/upload-artifact@v4
with:
name: pdf-output
path: output/public/*.pdf
- name: Update snapshot tag
if: ${{ needs.main-root.outputs.is-main }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
git config user.name ${{ env.GH_BOT_NAME }}
git config user.email ${{ env.GH_BOT_EMAIL }}
echo "Update tag for SNAPSHOT"
git push origin :refs/tags/SNAPSHOT
git tag -f SNAPSHOT
git push --tags
echo "Update SNAPSHOT release"
gh release upload SNAPSHOT --clobber output/public/*
# These must be done separately to correctly toggle draft flag
gh release edit SNAPSHOT -t "PDF snapshot" --prerelease
gh release view SNAPSHOT
gh release edit SNAPSHOT --draft=false