-
Notifications
You must be signed in to change notification settings - Fork 8
60 lines (52 loc) · 1.79 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:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "latest"
extended: true
- name: Rebuild the site
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
env:
RELEASEGEN_TOKEN: ${{ secrets.API_TOKEN }}
RELEASEGEN_VERSION: "0.5.2"
- name: Commit changes to data file
run: |
set -euo pipefail
git remote set-url origin https://x-access-token:"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git
git config --global user.email "charmbot@sgrs.uk"
git config --global user.name "juju-charm-bot"
git checkout $GITHUB_REF_NAME
git add data/repos.json
git commit -m "data: refresh release data" && git push --set-upstream origin $GITHUB_REF_NAME || true
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
user_name: juju-charm-bot
user_email: charmbot@sgrs.uk