Skip to content

Commit

Permalink
Merge pull request #27 from nitrictech/feat/go-releaser
Browse files Browse the repository at this point in the history
build: goreleaser and semantic version
  • Loading branch information
tjholm authored Jan 25, 2022
2 parents 4b34c54 + 00923ab commit 8ca4326
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches:
- main
- develop
workflow_dispatch:

jobs:
release:
name: semantic-release
runs-on: ubuntu-20.04
outputs:
new-release-published: ${{ steps.semantic-release.outputs.new_release_published }}
new-release-version: ${{ steps.semantic-release.outputs.new_release_version }}
steps:
- uses: actions/checkout@v2

- id: semantic-release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

goreleaser:
name: GoReleaser
needs:
- release
if: needs.release.outputs.new-release-published == 'true'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-go@v2
with:
go-version: 1.17

- uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ all.coverprofile
# Go workspace file
go.work
.vscode/

dist/
40 changes: 40 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
- go mod tidy
- make generate
builds:
- env:
- CGO_ENABLED=0
id: nitric
binary: nitric
main: ./pkg/cmd/
goos:
- linux
- windows
- darwin
archives:
- replacements:
darwin: macOS
linux: Linux
windows: Windows
386: i386
amd64: x86_64
archives:
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
skip: true
scoop:
bucket:
owner: nitrictech
name: scoop-bucket
homepage: "https://nitric.io"
description: "Nitric CLI"
license: Apache 2.0
8 changes: 8 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"branches": ["main", { "name": "develop", "prerelease": true }],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
}

0 comments on commit 8ca4326

Please sign in to comment.