Build and push only on main branch #4
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: Deploy website on push | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
# Check out fluxcd/website .github/workflows/netlify.yml | |
# We should emulate this fully - it has a hook from the fluxcd/community | |
# repository's github actions that enables community to trigger a deploy | |
repository_dispatch: | |
types: [trigger-workflow] | |
# (That's what a repository_dispatch workflow is meant to be doing here) | |
jobs: | |
fermyon-deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get latest flux-docs | |
uses: actions/checkout@v4 | |
- name: Get fluxcd/website (test-stimulus) | |
uses: actions/checkout@v4 | |
with: | |
repository: fluxcd/website | |
ref: test-stimulus | |
path: website | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: '0.122.0' | |
extended: true | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.21.0' | |
- name: Build content | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# make production-build URL=https://docs-fluxcd-website-6lrhgsuf.fermyon.app/ | |
pushd website | |
pip install -r requirements.txt | |
hugo version; popd | |
make build | |
- name: Install Spin | |
uses: fermyon/actions/spin/setup@v1 | |
- name: Push to OCI | |
id: push | |
uses: fermyon/actions/spin/push@v1 | |
with: | |
registry: ghcr.io | |
registry_username: ${{ github.actor }} | |
registry_password: ${{ secrets.GITHUB_TOKEN }} | |
registry_reference: "ghcr.io/kingdon-ci/flux-docs/build:${{ github.run_id }}-2" | |
manifest_file: spin.toml | |
- name: Deploy to Fermyon Cloud | |
uses: fermyon/actions/spin/deploy@v1 | |
with: | |
fermyon_token: ${{ secrets.FERMYON_CLOUD_TOKEN }} | |
run_build: false |