Skip to content

更新 go.yml

更新 go.yml #64

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Release Build
on:
push:
branches: [ "master" ]
tags:
- 'v*.*.*'
pull_request:
branches: [ "master" ]
tags:
- 'v*.*.*'
jobs:
build:
strategy:
matrix:
# Include amd64 on all platforms.
goos: [ windows, linux ]
goarch: [ amd64, 386 ]
goamd64: [ v1 ]
exclude:
# Exclude i386 on darwin and dragonfly.
- goarch: 386
goos: dragonfly
runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOAMD64: ${{ matrix.goamd64 }}
CGO_ENABLED: 0
BUILD_NAME: AutoInstall-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goamd64 }}${{ matrix.goos == 'windows' && '.exe' || '' }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
check-latest: true
- name: Build
run: go build -o dist/${{ env.BUILD_NAME }} app.go && ls dist
- name: Get version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}
path: dist/${{ env.BUILD_NAME }}
Publish:
permissions: write-all
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
draft: false
fail_on_unmatched_files: true