forgejo-cli/.woodpecker/deploy.yml

47 lines
1.8 KiB
YAML
Raw Normal View History

2023-12-17 05:45:28 +01:00
when:
2024-04-18 04:49:52 +02:00
- event: tag
2023-12-17 05:45:28 +01:00
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
2023-12-17 08:01:00 +01:00
- apt update
2023-12-17 07:56:18 +01:00
- apt install gcc-mingw-w64-x86-64 -y
2023-12-17 05:45:28 +01:00
- 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
2024-04-18 04:49:52 +02:00
- cd target/x86_64-pc-windows-gnu/release
- zip ../../../forgejo-cli-windows.zip fj.exe
- cd ../../..
2023-12-17 05:45:28 +01:00
- gzip -c target/x86_64-unknown-linux-gnu/release/fj > forgejo-cli-linux.gz
deploy-container:
image: gcr.io/kaniko-project/executor:debug
commands:
2023-12-17 20:33:04 +01:00
- 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"
2023-12-17 05:45:28 +01:00
secrets: [ token ]
release:
image: codeberg.org/cyborus/forgejo-cli:latest
pull: true
commands:
- export FORGE_HOST=$(echo $CI_FORGE_URL | sed -E 's_^https?://__')
2023-12-17 20:33:04 +01:00
- fj auth add-key $FORGE_HOST $CI_REPO_OWNER $TOKEN
2024-04-18 04:49:52 +02:00
- fj release --repo $CI_REPO_URL asset create $CI_COMMIT_TAG forgejo-cli-windows.zip
- fj release --repo $CI_REPO_URL asset create $CI_COMMIT_TAG forgejo-cli-linux.gz
2023-12-17 20:33:04 +01:00
- fj auth logout $FORGE_HOST
2023-12-17 05:45:28 +01:00
secrets: [ token ]