Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a GA to populate zw3rk S3 buckets on push events
Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>
- Loading branch information
1 parent
6e6f634
commit edcc33e
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: prebuild devx closures | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the "master" branch | ||
push: | ||
branches: | ||
- main | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Nix with good defaults | ||
uses: cachix/install-nix-action@v17 | ||
with: | ||
extra_nix_config: | | ||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | ||
substituters = https://cache.iog.io/ https://cache.zw3rk.com/ https://cache.nixos.org/ | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Compute and upload closure and developer environment on a custom S3 bucket | ||
run: ./extra/s3-uploads.sh ${{ secrets.KEY_ID }} ${{ secrets.SECRET }} ${{ secrets.SECRET_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#! /usr/bin/env nix-shell | ||
#! nix-shell -i bash -p awscli zstd | ||
|
||
DEV_SHELLS=( | ||
"ghc8107" | ||
"ghc902" | ||
"ghc925" | ||
"ghc8107-minimal" | ||
"ghc902-minimal" | ||
"ghc925-minimal" | ||
"ghc8107-static-minimal" | ||
"ghc902-static-minimal" | ||
"ghc925-static-minimal" | ||
) | ||
|
||
SYSTEMS=("aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux") | ||
|
||
# shellcheck disable=SC2034 | ||
AWS_DEFAULT_REGION=us-east-1 | ||
# shellcheck disable=SC2034 | ||
AWS_ACCESS_KEY_ID="$1" | ||
# shellcheck disable=SC2034 | ||
AWS_SECRET_ACCESS_KEY="$2" | ||
|
||
# Generated with: % nix key generate-secret --key-name s3.zw3rk.com | ||
echo "$3" > ./secret-key | ||
|
||
for system in "${SYSTEMS[@]}"; do | ||
for devShell in "${DEV_SHELLS[@]}"; do | ||
nix build ".#devShells.${system}.${devShell}" | ||
nix store sign --key-file ./secret-key --recursive ./result | ||
# shellcheck disable=SC2046 | ||
nix-store --export $(nix-store -qR result) | zstd -z8T8 > "${system}.${devShell}.zstd" | ||
nix print-dev-env ".#devShells.${system}.${devShell}" > "${system}.${devShell}.sh" | ||
aws --endpoint-url https://s3.zw3rk.com s3 cp "./${system}.${devShell}.sh" s3://devx/ | ||
aws --endpoint-url https://s3.zw3rk.com s3 cp "./${system}.${devShell}.zstd" s3://devx/ | ||
done | ||
done |