This commit is contained in:
59
.woodpecker.yml
Normal file
59
.woodpecker.yml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# 只调度到你的 macOS 本机 agent(local/exec)
|
||||||
|
labels:
|
||||||
|
host: Mac-mini.local
|
||||||
|
platform: darwin/arm64
|
||||||
|
gpu: metal
|
||||||
|
when:
|
||||||
|
event: [push, manual, pull_request]
|
||||||
|
steps:
|
||||||
|
- name: create some file
|
||||||
|
image: /bin/zsh
|
||||||
|
commands:
|
||||||
|
- echo "Hello, World!" > hello.txt
|
||||||
|
|
||||||
|
- name: upload-hello-txt
|
||||||
|
image: /bin/zsh
|
||||||
|
environment:
|
||||||
|
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||||||
|
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
|
||||||
|
S3_BUCKET: ${S3_BUCKET}
|
||||||
|
S3_ENDPOINT: ${S3_ENDPOINT}
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
if [[ -n "$AWS_ACCESS_KEY_ID" && -n "$AWS_SECRET_ACCESS_KEY" && -n "$S3_BUCKET" ]]; then
|
||||||
|
echo "Uploading hello.txt to S3..."
|
||||||
|
# 设置 plugin-s3 环境变量
|
||||||
|
export PLUGIN_SOURCE="hello.txt"
|
||||||
|
export PLUGIN_BUCKET="$S3_BUCKET"
|
||||||
|
export PLUGIN_TARGET="woodpecker-test/"
|
||||||
|
[[ -n "$S3_ENDPOINT" ]] && export PLUGIN_ENDPOINT="$S3_ENDPOINT" && export PLUGIN_PATH_STYLE=true
|
||||||
|
plugin-s3
|
||||||
|
echo "✅ hello.txt uploaded successfully!"
|
||||||
|
else
|
||||||
|
echo "⚠️ No S3 credentials found. Skipping upload."
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: s3-upload-demo
|
||||||
|
image: /bin/zsh
|
||||||
|
environment:
|
||||||
|
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
|
||||||
|
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
|
||||||
|
S3_BUCKET: ${S3_BUCKET}
|
||||||
|
S3_ENDPOINT: ${S3_ENDPOINT}
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
if [[ -n "$AWS_ACCESS_KEY_ID" && -n "$AWS_SECRET_ACCESS_KEY" && -n "$S3_BUCKET" ]]; then
|
||||||
|
echo "Hello S3 from Woodpecker at $(date)" > s3-demo.txt
|
||||||
|
# plugin-s3 的环境变量(与容器版一致)
|
||||||
|
export PLUGIN_SOURCE="s3-demo.txt"
|
||||||
|
export PLUGIN_BUCKET="$S3_BUCKET"
|
||||||
|
export PLUGIN_TARGET="woodpecker-demo/"
|
||||||
|
[[ -n "$S3_ENDPOINT" ]] && export PLUGIN_ENDPOINT="$S3_ENDPOINT" && export PLUGIN_PATH_STYLE=true
|
||||||
|
plugin-s3
|
||||||
|
else
|
||||||
|
echo "No S3 creds found. Skipping s3-upload-demo."
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user