dotfiles/.woodpecker/agent-release.yml
2023-10-12 22:13:00 +03:00

43 lines
1.3 KiB
YAML

#depends_on:
# - build
# - test
# - lint
when:
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
matrix:
BUILD_TARGET:
- x86_64
- aarch64
steps:
build:
image: nixos/nix:latest
commands:
- export AWS_ACCESS_KEY_ID="$${R2_CACHE_ACCESS_KEY}"
- export AWS_SECRET_ACCESS_KEY="$${R2_CACHE_SECRET_KEY}"
- echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
- echo "substituters = s3://prymn-cache?endpoint=75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com&region=auto https://cache.nixos.org/" >> /etc/nix/nix.conf
- nix build -L ".#agent.${BUILD_TARGET}"
- mkdir -p "dist/${BUILD_TARGET}-unknown-linux-musl"
- cp result/bin/prymn_agent "dist/${BUILD_TARGET}-unknown-linux-musl/"
- nix copy --to 's3://prymn-cache?endpoint=75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com&region=auto' ".#agent.${BUILD_TARGET}"
secrets: [ R2_CACHE_ACCESS_KEY, R2_CACHE_SECRET_KEY ]
release:
image: woodpeckerci/plugin-s3
settings:
bucket: prymn-static
region: auto
endpoint:
from_secret: R2_STATIC_ADDRESS
access_key:
from_secret: R2_DEPLOY_ACCESS_KEY
secret_key:
from_secret: R2_DEPLOY_SECRET_KEY
source: dist/**/*
target: /agent
strip_prefix: dist/