Skip to content

Commit

Permalink
build: added github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan committed Jul 6, 2022
1 parent 7e703be commit 32c3f58
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/on_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: on-push

on:
push:
branches:
- "*"
pull_request:
branches:
- main

jobs:
build_snapshot:
name: Build Snapshot
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# so we get proper snapshot version info
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: latest
args: release --rm-dist --snapshot
36 changes: 36 additions & 0 deletions .github/workflows/on_tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: tagged-release

on:
push:
tags:
- "v*"

jobs:
tagged-release:
name: Tagged Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: latest
args: release --rm-dist

0 comments on commit 32c3f58

Please sign in to comment.