-
-
Notifications
You must be signed in to change notification settings - Fork 325
79 lines (63 loc) · 2.23 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: "CI"
on:
workflow_dispatch:
push:
branches:
- main
- preview
pull_request:
permissions:
contents: write
pull-requests: write
statuses: write
deployments: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
build:
name: "Build nixos.org"
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@v23
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: "Setup Cachix"
uses: cachix/cachix-action@v12
with:
name: nixos-homepage
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: "Build"
run: |
nix develop --command npm install
nix develop --command npm run build
mkdir build
cp -RL ./dist/* ./build/
cp -RL ./netlify.toml ./build/
- name: "Publish to Netlify"
if: github.repository == 'NixOS/nixos-homepage'
uses: nwtgck/actions-netlify@v2.1.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
# TODO: once we make main branch default we should change master->main
production-branch: 'master'
production-deploy: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
alias: ${{ github.event_name == 'push' && github.ref_name || '' }}
enable-github-deployment: ${{ github.event_name == 'push' && 'true' || 'false' }}
github-deployment-environment: ${{ github.event_name == 'push' && github.ref_name || format('pull-request-{0}', github.event.number) }}