ProxySwitcher/.github/workflows/publish.yml

60 lines
1.3 KiB
YAML
Raw Normal View History

2024-09-01 11:01:45 +00:00
# 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: Publish
2024-09-01 11:01:45 +00:00
on:
push:
tags: 'v*'
2024-09-01 11:01:45 +00:00
env:
GOOS: windows
GOARCH: amd64
2024-09-01 11:01:45 +00:00
jobs:
2024-09-01 11:01:45 +00:00
build:
runs-on: ubuntu-latest
2024-09-01 11:01:45 +00:00
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
2024-09-01 11:01:45 +00:00
- name: Set up Go
uses: actions/setup-go@v5
2024-09-01 11:01:45 +00:00
with:
go-version: "${{ env.GO_VERSION }}"
2024-09-01 11:01:45 +00:00
- name: Install dependencies
run: |
go get .
- name: Build project
run: go build -o build/ -v ./...
2024-09-01 11:01:45 +00:00
2024-09-01 13:36:17 +00:00
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ProxySwitcher
path: build/*
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ProxySwitcher
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.event.workflow_run.head_ref }}" \
--title "Release ${{ github.event.workflow_run.head_ref }}" \
ProxySwitcher