Skip to content

Build/Deploy

Build/Deploy #27879

Workflow file for this run

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 "[email protected]"
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: [email protected]