-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.79 KB
/
build_tree.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
name: "Build tree"
on:
repository_dispatch:
types: [trigger-workflow]
jobs:
build-tree:
runs-on: ${{ matrix.os }}
permissions:
id-token: "write"
contents: "read"
strategy:
matrix:
os: ${{ github.event.client_payload.platforms }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Access Payload Data
run: |
echo "Branch: ${{ github.event.client_payload.ref_name }}"
echo "Branch: ${{ github.event.client_payload.platforms }}"
- name: Determine Nix file to use
id: determine-file
run: |
year=$(echo "${{ github.event.client_payload.ref_name }}" | cut -c1-4)
if [ "$year" -le 2020 ]; then
echo "nix_file=default_2020.nix" >> $GITHUB_ENV
else
echo "nix_file=default.nix" >> $GITHUB_ENV
fi
- run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sed -i 's/REPLACE_DATE/${{ github.event.client_payload.ref_name }}/g' ${{ env.nix_file }}
else
sed -i '' 's/REPLACE_DATE/${{ github.event.client_payload.ref_name }}/g' ${{ env.nix_file }}
fi
- uses: cachix/cachix-action@v15
with:
name: rstats-on-nix
authToken: '${{ secrets.CACHIX_AUTH }}'
- name: Build on date ${{ github.event.client_payload.ref_name }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
nix-build --max-jobs 1 --cores 2 --argstr system x86_64-linux ${{ env.nix_file }}
nix-build --max-jobs 1 --cores 2 --argstr system aarch64-linux ${{ env.nix_file }}
else
nix-build --max-jobs 1 --cores 2 ${{ env.nix_file }}
fi