Skip to content

Commit

Permalink
add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vinymeuh committed Jan 27, 2024
1 parent 938cc25 commit 8e63c6e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 22 deletions.
52 changes: 33 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:

name: Release

jobs:
create_draft_release:
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
runs-on: ubuntu-latest
Expand All @@ -16,25 +18,37 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
version: ${{ github.ref_name }}

# release:
# strategy:
# matrix:
# include:
# - os: ubuntu-latest
# artifact_file: hifumi-linux-amd64.tgz
# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Setup Go
# uses: actions/setup-go@v4
# with:
# go-version-file: './go.mod'
# - name: Build release
# run: |
# go build -o hifumi cmd/hifumi/main.go
release:
needs: create_draft_release
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
artifact: hifumi-linux-amd64.tar.gz
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: Build binary
run: |
go build -o hifumi cmd/hifumi/main.go
- name: Create artifact
run: |
tar czf ${{ matrix.artifact }} hifumi
- name: Upload artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.ref_name }} ${{ matrix.artifact }} --clobber
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
on:
push:
tags-ignore:
- v*
branches:
- '**'
pull_request:
branches:
- main
Expand All @@ -19,7 +19,7 @@ jobs:
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: Run tests for shogi package
Expand Down

0 comments on commit 8e63c6e

Please sign in to comment.