Build/Deploy #28547
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |