Daily Build & Deploy to Netlify #29371
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: "Daily Build & Deploy to Netlify" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
hourly-build-and-deploy: | |
name: "Hourly build & deploy" | |
runs-on: "ubuntu-latest" | |
if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }} | |
steps: | |
- name: "Checking out the repository" | |
uses: "actions/checkout@v4" | |
with: | |
fetch-depth: 0 | |
- name: "Installing Nix" | |
uses: "cachix/install-nix-action@v26" | |
- name: "Setup Cachix" | |
uses: "cachix/cachix-action@v14" | |
with: | |
name: "nixos-homepage" | |
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" | |
- name: "Update content" | |
run: | | |
nix flake lock \ | |
--update-input released-nixpkgs-unstable \ | |
--update-input released-nixpkgs-stable \ | |
--update-input released-nix-unstable \ | |
--update-input released-nix-stable \ | |
--update-input nix-pills | |
- name: "Build" | |
run: | | |
nix develop --command npm install | |
nix develop --command npm run build | |
mkdir build | |
cp -RL ./dist/* ./build/ | |
- name: "Deploy to Netlify" | |
if: ${{ github.repository == 'NixOS/nixos-homepage' }} | |
uses: "nwtgck/actions-netlify@v3.0.0" | |
env: | |
NETLIFY_AUTH_TOKEN: "${{ secrets.NETLIFY_AUTH_TOKEN }}" | |
NETLIFY_SITE_ID: "${{ secrets.NETLIFY_SITE_ID }}" | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
deploy-message: "Published from GitHub Actions" | |
publish-dir: "./build" | |
enable-pull-request-comment: true | |
overwrites-pull-request-comment: false | |
enable-commit-comment: false | |
enable-commit-status: true | |
production-branch: "main" | |
production-deploy: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
alias: "${{ github.event_name == 'push' && github.ref_name || '' }}" | |
enable-github-deployment: ${{ github.event_name == 'push' }} | |
github-deployment-environment: "${{ github.event_name == 'push' && github.ref_name || format('pull-request-{0}', github.event.number) }}" | |
- name: "Commit updated files and push them to main branch" | |
if: ${{ github.repository == 'NixOS/nixos-homepage' }} | |
uses: "stefanzweifel/git-auto-commit-action@v5" | |
with: | |
commit_message: "Daily update [ci skip]" | |
branch: "main" | |
file_pattern: "flake.lock" | |
commit_user_name: "NixOS webmaster" | |
commit_user_email: "webmaster@nixos.org" | |
commit_author: "GitHub Actions <webmaster@nixos.org>" |