赞
踩
之前挖了一个坑,慢慢补上。
上篇文章介绍了如何自动生成 Release 的内容,本文章旨在介绍如何借助 GitHub Actions 在 Release 时自动上传打包好的工程。
使用此 Action 可以将特定的文件上传至 release 中。
github.com/JasonEtco/upload-to-release
.github/workflows/upload-to-release.yml
name: Go Release on: release: types: [published] jobs: release: if: github.repository == 'PasteUs/HelloCI' name: Build with go ${{ matrix.go_version }} on ${{ matrix.os }} and upload runs-on: ${{ matrix.os }} strategy: matrix: go_version: [1.13] os: [ubuntu-latest] steps: - name: Set up Go ${{ matrix.go_version }} uses: actions/setup-go@v1 with: go-version: ${{ matrix.go_version }} id: go - name: Check out code into the Go module directory uses: actions/checkout@v1 - name: Get dependencies run: | go get -v -t -d ./... if [ -f Gopkg.toml ]; then curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh dep ensure fi - name: Build run: | go build -v -o main . - name: Gzip run: | mkdir hello-word-${{ matrix.os }} cp main hello-word-${{ matrix.os }} tar -czvf hello-word-${{ matrix.os }}.tar.gz hello-word-${{ matrix.os }} - name: Upload to release uses: JasonEtco/upload-to-release@master with: args: hello-word-${{ matrix.os }}.tar.gz application/octet-stream env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。