-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (67 loc) · 2.04 KB
/
flake-ci.yaml
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
80
81
82
name: Build and Release Sursface
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
initialize_release:
name: Initialize GitHub Release
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create_release.outputs.id }}
tag_name: ${{ steps.generate_tag.outputs.tag }}
steps:
- name: Generate Tag Name
id: generate_tag
run: |
TAG_NAME="v$(date +'%Y%m%d%H%M%S')"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "::set-output name=tag::$TAG_NAME"
- name: Create Empty Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.generate_tag.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
build:
name: Build Binaries
runs-on: ubuntu-latest
needs: initialize_release
strategy:
matrix:
target: [
"x86_64-linux",
"x86_64-windows",
"wasm32-unknown"
]
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Nix
uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=channel=nixos-23.11
- name: Install Cachix
run: nix-env -iA cachix -f https://cachix.org/api/v1/install
- name: Use Cachix
run: cachix use thinnerthinker
- name: Build Package
run: |
nix build .#${{ matrix.target }}
mkdir -p output
zip -r output/sursface-${{ matrix.target }}.zip result/*
- name: Upload to Release
uses: AButler/[email protected]
with:
files: "output/sursface-${{ matrix.target }}.zip"
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-id: ${{ needs.initialize_release.outputs.release_id }}
- name: Authenticate with Cachix
run: cachix authtoken ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Push to Cachix
run: nix path-info --all | cachix push thinnerthinker