Skip to content

trigger-workflow

trigger-workflow #415

Workflow file for this run

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_month=$(echo "${{ github.event.client_payload.ref_name }}" | cut -c1-7)
year=$(echo "$year_month" | cut -d'-' -f1)
if [ "$year_month" = "2020-03" ]; then
echo "nix_file=default_2019.nix" >> $GITHUB_ENV
elif [ "$year" -eq 2020 ]; then
echo "nix_file=default_2020.nix" >> $GITHUB_ENV
elif [ "$year" -eq 2019 ]; then
echo "nix_file=default_2019.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