ProxySwitcher/.github/workflows/build.yml

60 lines
1.4 KiB
YAML

# 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: Go
on:
push:
tags: 'v*'
env:
GOOS: windows
GOARCH: amd64
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get GoLang version
run: sed -En 's/^go (.*)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
- name: Install dependencies
run: |
go get .
- name: Build project
run: go build -o build/ -v ./...
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: build/ProxySwitcher.exe
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/ProxySwitcher.exe
asset_name: ProxySwitcher.exe
asset_content_type: x-msdownload