UPDATE workflows #2
Workflow file for this run
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: CreateRelease | |
on: | |
release: | |
types: | |
- prereleased | |
# - released | |
push: | |
tags: | |
- "v*" | |
jobs: | |
create_release: | |
if: github.event_name == 'push' | |
name: Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Create PreRelease | |
id: create_release | |
uses: actions/create-release@v1 | |
if: github.event_name == 'push' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref_name }} | |
body: 修复了一些已知问题。 | |
draft: false | |
prerelease: true | |
build: | |
name: Build App | |
# if: github.event_name == 'release' | |
# needs: create_release | |
strategy: | |
matrix: | |
goos: [windows, linux, darwin] | |
permissions: # 需要设置写权限才能自动发布 | |
contents: write | |
runs-on: ubuntu-latest | |
env: | |
GOOS: ${{ matrix.goos }} | |
CGO_ENABLED: 0 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.x' | |
- name: Install dependencies | |
run: | | |
go env -w GO111MODULE=on | |
go env -w GOPROXY=https://goproxy.cn,direct | |
sudo apt-get update -y | |
sudo apt-get install -y gcc libgl1-mesa-dev xorg-dev | |
go mod tidy | |
go install fyne.io/fyne/v2/cmd/fyne@latest | |
- name: Get File Name | |
id: get_filename | |
run: | | |
export _NAME=DownUtils-${{ matrix.goos }}.tar.gz | |
echo "GOOS: $GOOS, GOARCH: $GOARCH, RELEASE_NAME: $_NAME" | |
echo "ASSET_NAME=$_NAME" >> $GITHUB_OUTPUT | |
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
GOPATH=$(go env GOPATH) | |
ls $GOPATH/bin | |
$(GOPATH)/bin/fyne package -os ${{ matrix.goos }} -icon resource/images/logo.png | |
ls *.exe *.tar* | |
- name: Package | |
run: tar zcvf ${{ steps.get_filename.outputs.ASSET_NAME }} *.exe *.tar* | |
# 上传附件 | |
- name: Upload file to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.get_filename.outputs.ASSET_NAME }} | |
path: ${{ steps.get_filename.outputs.ASSET_NAME }} | |
- name: Upload files to GitHub release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file_glob: true | |
file: ./${{ steps.get_filename.outputs.ASSET_NAME }} | |
tag: ${{ github.ref }} | |
overwrite: true |