forgejo-cli/.woodpecker/deploy.yml
Cyborus f326e93e84
[ci] set FORGE_HOST env var in release step
apparently env vars do not carry over between steps
2023-12-17 15:21:46 -05:00

43 lines
1.7 KiB
YAML

when:
- event: deployment
steps:
compile-linux:
image: rust:latest
commands:
- rustup target add x86_64-unknown-linux-gnu
- cargo build --target=x86_64-unknown-linux-gnu --release
- strip target/x86_64-unknown-linux-gnu/release/fj
compile-windows:
image: rust:latest
commands:
- rustup target add x86_64-pc-windows-gnu
- apt update
- apt install gcc-mingw-w64-x86-64 -y
- cargo build --target=x86_64-pc-windows-gnu --release
- strip target/x86_64-pc-windows-gnu/release/fj.exe
zip:
image: debian:12
commands:
- apt update
- apt install zip -y
- zip forgejo-cli-windows.zip target/x86_64-pc-windows-gnu/release/fj.exe
- gzip -c target/x86_64-unknown-linux-gnu/release/fj > forgejo-cli-linux.gz
deploy-container:
image: gcr.io/kaniko-project/executor:debug
commands:
- export FORGE_HOST=$(echo $CI_FORGE_URL | sed -E 's_^https?://__')
- export AUTH="$(echo -n $CI_REPO_OWNER:$TOKEN | base64)"
- echo "{\"auths\":{\"$FORGE_HOST\":{\"auth\":\"$AUTH\"}}}" > "/kaniko/.docker/config.json"
- export CONTAINER_OWNER=$(echo $CI_REPO_OWNER | awk '{print tolower($0)}')
- executor --context ./ --dockerfile ./Dockerfile --destination "$FORGE_HOST/$CONTAINER_OWNER/forgejo-cli:latest"
secrets: [ token ]
release:
image: codeberg.org/cyborus/forgejo-cli:latest
pull: true
commands:
- export FORGE_HOST=$(echo $CI_FORGE_URL | sed -E 's_^https?://__')
- fj auth add-key $FORGE_HOST $CI_REPO_OWNER $TOKEN
- fj --remote $CI_REPO_URL release create $VERSION --create-tag --branch $BRANCH --attach forgejo-cli-windows.zip --attach forgejo-cli-windows.gz
- fj auth logout $FORGE_HOST
secrets: [ token ]