summary refs log tree commit diff
path: root/.github/workflows/deploy.yml
blob: ea2835fcc13b53dbf51d551847afe8f4bb2c210a (plain)
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: "Build & Deploy to Netlify"
on:
  push:
    branches:
      - master
  repository_dispatch:
    types: [update]

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest

    steps:
    - name: Checking out the repository
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Installing Nix
      uses: cachix/install-nix-action@v12
      with:
        nix_path: nixpkgs=channel:nixpkgs-unstable
        install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install
        extra_nix_config: |
          experimental-features = nix-command flakes

    - uses: cachix/cachix-action@v8
      with:
        name: pn
        signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'

    - name: update.sh
      if: github.event.action == 'update'
      run: |
        nix-shell -p nix-prefetch-git --command './update.sh'
    - name: Commit changes
      if: github.event.action == 'update'
      uses: EndBug/add-and-commit@v7
      with:
        author_name: github-actions[bot]
        author_email: 41898282+github-actions[bot]@users.noreply.github.com
        message: '[🤖] Update kronika.json'
        add: 'kronika.json'

    - name: Building site
      run: |
        nix build
        mkdir build
        cp -RL ./result/* ./build/

    - uses: actions/upload-artifact@v2
      with:
        name: site
        path: ./build

    - name: Deploy to Netlify
      uses: nwtgck/actions-netlify@v1.1
      env:
        NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
        NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
      with:
        production-branch: 'master'
        production-deploy: true
        publish-dir: './build'
        github-token: ${{ secrets.GITHUB_TOKEN }}
        deploy-message: 'Deploy from GitHub Actions'
        enable-pull-request-comment: true
        enable-commit-comment: true
        enable-commit-status: true
        overwrites-pull-request-comment: false
      if: github.repository == '19pdh/low-puszcza'

    - name: Deploy 🚀
      uses: JamesIves/github-pages-deploy-action@3.7.1
      with:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        BRANCH: gh-pages # The branch the action should deploy to.
        FOLDER: build # The folder the action should deploy.
        CLEAN: true # Automatically remove deleted files from the deploy branch