Skip to content

Commit

Permalink
ci: add GitHub Actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Siroshun09 committed May 19, 2022
1 parent 6097568 commit 4b5a616
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Go Build
on: [push, pull_request]

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout"
uses: actions/[email protected]
with:
fetch-depth: 0
- name: "Set up Go"
uses: actions/[email protected]
with:
go-version: 1.18
- name: "Set up cache"
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
distribution: goreleaser
version: latest
args: build --snapshot --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
uses: actions/[email protected]
with:
name: Artifacts
path: dist
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Go Release
on:
push:
# run only against tags
tags:
- '*'
permissions:
contents: write

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout"
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: "Set up Go"
uses: actions/[email protected]
with:
go-version: 1.18
- name: "Set up cache"
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 4b5a616

Please sign in to comment.