-
Notifications
You must be signed in to change notification settings - Fork 6
149 lines (131 loc) · 3.89 KB
/
update-content.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: update-activity-content
on:
schedule:
- cron: '47 5,21 * * *'
push:
branches:
- 'main'
paths:
- '.github/*.ts'
- 'tasks/graphql/**'
- '_config.ts'
- 'deno.json'
- 'member/**'
- 'site/**'
repository_dispatch:
workflow_dispatch:
permissions:
contents: read
env:
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GH_BOT_NAME: "GitHub Action"
DENO_DIR: .deno-cache
REPO: commonhaus/commonhaus.github.io
jobs:
build_refresh:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
concurrency:
group: "push-content"
outputs:
updated: steps.git-push.outputs.updated || steps.submodule.outputs.updated || steps.about.outputs.updated || steps.discussion.outputs.updated
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ hashFiles('deno.lock') }}
- name: Cache Deno dependencies
uses: actions/cache@v4
with:
path: ${{ env.DENO_DIR }}
key: ${{ hashFiles('deno.lock') }}
- name: Setup Deno environment
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Build info
run: deno info
- name: Git Config
run: |
git config user.name ${{ env.GH_BOT_NAME }}
git config user.email ${{ env.GH_BOT_EMAIL }}
- id: git-push
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
echo "updated=true" >> $GITHUB_OUTPUT
- name: Git Submodule Update
id: submodule
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git pull --recurse-submodules
git submodule update --init --remote --recursive
deno task lastmod
if git diff --quiet; then
echo "-- No changes -- "
else
git commit -am "🆙 Auto-update submodule references"
git pull --rebase
git push
echo "updated=true" >> $GITHUB_OUTPUT
fi
- name: Foundation Metadata Update
id: about
env:
GH_TOKEN: ${{ secrets.WEB_REPO_READ }}
run: |
deno task about
git add -A -- ./site/_generated/about.yml
if git diff --quiet HEAD; then
echo "-- No changes -- "
else
git commit -am "👥 Auto-update foundation metadata"
git pull --rebase
git push
echo "updated=true" >> $GITHUB_OUTPUT
fi
- name: Git Discussion Update
id: discussion
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
deno task activity
git add -A -- ./site/_generated/activity ./site/_generated/authors.yml
if git diff --quiet HEAD; then
echo "-- No changes -- "
else
git commit -am "💬 Auto-update GH Activity"
git pull --rebase
git push
echo "updated=true" >> $GITHUB_OUTPUT
fi
process_votes:
concurrency:
group: "push-content"
permissions:
contents: write
uses: commonhaus/vote-record-actions/.github/workflows/receive-votes.yml@main
with:
repositories: "commonhaus/foundation"
target_dir: "site/_generated/votes"
branch: "main"
secrets: inherit
update:
needs: [build_refresh, process_votes]
if: needs.process_votes.outputs.votes_updated || needs.build_refresh.outputs.updated
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Push GH Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh workflow run -R commonhaus/commonhaus.github.io gh-pages.yml