Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsugu committed Aug 12, 2024
1 parent 2015703 commit 0eef7c2
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build and Deploy Go Program

on:
push:
tags:
- '*' # すべてのタグがプッシュされたときに実行

jobs:
build:
name: Build and Deploy
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest] # macOS を対象外に
go-version: [1.22.*]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Build binary
run: |
go build -o output/${{ matrix.os }}/myapp
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: myapp-${{ matrix.os }}
path: output/${{ matrix.os }}/myapp

deploy:
name: Deploy binaries
needs: build
runs-on: ubuntu-latest

steps:
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: myapp-ubuntu-latest

- name: Deploy to GitHub Releases
uses: softprops/action-gh-release@v1
with:
files: output/ubuntu-latest/myapp

- name: Download binaries (Windows)
uses: actions/download-artifact@v3
with:
name: myapp-windows-latest

- name: Deploy to GitHub Releases (Windows)
uses: softprops/action-gh-release@v1
with:
files: output/windows-latest/myapp.exe

0 comments on commit 0eef7c2

Please sign in to comment.