67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
name: Check
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types: [opened, reopened, edited, auto_merge_enabled, synchronize]
|
|
|
|
jobs:
|
|
check:
|
|
name: check
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
contains(github.event.head_commit.message, 'bump:') == false &&
|
|
contains(github.event.head_commit.message, 'Merge pull request') == false
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install nix
|
|
uses: cachix/install-nix-action@v31
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
|
|
- name: Use cachix
|
|
uses: cachix/cachix-action@v16
|
|
with:
|
|
name: trevstack
|
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
|
|
|
- run: nix flake check --accept-flake-config
|
|
|
|
push:
|
|
name: push
|
|
runs-on: ubuntu-latest
|
|
needs: check
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: "0"
|
|
|
|
# https://github.com/actions/checkout/issues/13
|
|
- name: Push to Production
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git push origin main:production
|
|
|
|
update:
|
|
name: update
|
|
runs-on: ubuntu-latest
|
|
if: ${{ contains(github.event.head_commit.message, 'Merge pull request') }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: "0"
|
|
|
|
# https://github.com/actions/checkout/issues/13
|
|
- name: Push to Production
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git push origin main:production
|