35 lines
1.4 KiB
YAML
35 lines
1.4 KiB
YAML
name: 'Initialize CI Environment and Repository'
|
|
description: 'Initialize a CI environment with nix (and also checkout the repository recursively with LFS)'
|
|
inputs:
|
|
token:
|
|
description: 'OAUTH token to access repositories'
|
|
required: false
|
|
default: ${{ github.token }}
|
|
lfs:
|
|
description: 'Whether to enable lfs'
|
|
required: false
|
|
default: true
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Setup NIX CI Environment
|
|
run: |
|
|
echo "substituters = https://nixpkgs-cache.qo.is?priority=39" >> /etc/nix/nix.conf
|
|
echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" >> /etc/nix/nix.conf
|
|
nix profile install nixpkgs#git-lfs nixpkgs#gnused
|
|
mkdir -p ~/.config/nix && cp /etc/nix/nix.conf ~/.config/nix/
|
|
|
|
- name: Enable lfs
|
|
if: inputs.lfs == true
|
|
shell: "nix shell nixpkgs#git-lfs nixpkgs#gnused --command {0}"
|
|
run: |
|
|
git lfs install
|
|
|
|
- name: Checkout Repository
|
|
shell: "nix shell nixpkgs#git-lfs nixpkgs#gnused --command {0}"
|
|
run: |
|
|
GIT_SERVER=`echo -n "$GITHUB_SERVER_URL" | sed "s%https://%%"`
|
|
echo -e "machine $GIT_SERVER\nlogin oauth2\npassword ${{ inputs.token }}" > ~/.netrc
|
|
# Disable clone protection to pull LFS as well
|
|
GIT_CLONE_PROTECTION_ACTIVE=false git clone --branch $GITHUB_REF_NAME --recurse-submodules $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .
|
|
git submodule update --init
|