Skip to content

Build/Deploy

Build/Deploy #8345

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:
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]