-
Notifications
You must be signed in to change notification settings - Fork 4
60 lines (52 loc) · 1.8 KB
/
build.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
name: Build/Deploy
on:
workflow_dispatch: {}
push:
branches:
- main
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "0 * * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
environment: "github-pages"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "latest"
extended: true
- name: Rebuild the site
env:
RELEASEGEN_TOKEN: ${{ secrets.SNAPCRAFTERS_BOT_READ }}
RELEASEGEN_VERSION: "0.5.1"
run: |
wget -qO releasegen.tar.gz "https://github.com/jnsgruk/releasegen/releases/download/v${RELEASEGEN_VERSION}/releasegen_${RELEASEGEN_VERSION}_linux_x86_64.tar.gz"
tar xvzf releasegen.tar.gz
./releasegen > data/repos.json
hugo --minify
- name: Commit changes to data file
env:
GITHUB_TOKEN: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
run: |
set -euo pipefail
git config --global user.name 'Snapcrafters Bot'
git config --global user.email '[email protected]'
git add data/repos.json
git commit -m "data: refresh release data" && git push --set-upstream origin $GITHUB_REF_NAME || true
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.SNAPCRAFTERS_BOT_COMMIT }}
publish_dir: ./public
user_name: snapcrafters-bot
user_email: [email protected]