Skip to content

update release.yml

update release.yml #3

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
env:
GO_VERSION: stable
jobs:
build_for_linux:
name: Build for Linux
runs-on: ubuntu-latest
steps:
- name: Install build dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y --no-install-recommends build-essential
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Build amd64
env:
CGO_ENABLED: 1
GOOS: linux
GOARCH: amd64
run: |
go build -o jisyotool .
zip -r jisyotool-linux.zip jisyotool
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-linux
path: jisyotool-linux.zip
build_for_macos:
name: Build for macOS
runs-on: macos-13
steps:
- name: Install build dependencies
run: brew install coreutils
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Build amd64
env:
CGO_ENABLED: 1
GOOS: darwin
GOARCH: amd64
run: |
go build -o jisyotool .
zip -r jisyotool-darwin.zip jisyotool
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-darwin
path: jisyotool-darwin.zip
build_for_windows:
name: Build for Windows
runs-on: windows-latest
steps:
- name: Install build dependencies
run: choco install zip
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Build amd64
shell: bash
env:
CGO_ENABLED: 1
GOOS: windows
GOARCH: amd64
run: |
go build -o jisyotool.exe .
zip -r jisyotool-windows.zip jisyotool.exe
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-windows
path: jisyotool-windows.zip
release:
name: Draft Release
needs:
- build_for_linux
- build_for_macos
- build_for_windows
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Check out repository code
uses: actions/checkout@v3
- name: Create draft release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF#refs/tags/}"
gh release create "$tag" --title="$tag" --draft \
dist-*/jisyotool-*.zip