add auto release #11
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
name: Go | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23" | |
- name: Build | |
run: go build -v -o output/go_webdav_client ./... | |
- name: Build arm64 | |
run: export GOOS=linux; export GOARCH=arm64; go build -v -o output/go_webdav_client_arm64 ./... | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: go_webdav_client-build | |
path: output/go_webdav_client* # 指定要上传的编译文件路径 | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: go_webdav_client-build | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: output/go_webdav_client* # 将下载的二进制文件发布到 release 中 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用 GitHub 的 token 来授权发布 |