Skip to content

Commit

Permalink
feat: Automatic release process (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
alldoami authored Mar 21, 2022
1 parent 9e5b8ba commit 02584d2
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 35 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
push:
branches:
- main

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
id: configure-changelog
with:
result-encoding: string
script: |
const changelogTypes = [
{type: "feat", section: "Features", hidden: false},
{type: "chore", section: "Misc", hidden: false},
{type: "fix", section: "BugFixes", hidden: false},
]
return JSON.stringify(changelogTypes)
# See https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
# For why we need to generate a token and not use the default
- name: Generate token
id: generate_token
uses: chanzuckerberg/[email protected]
with:
app_id: ${{ secrets.CZI_RELEASE_PLEASE_APP_ID }}
private_key: ${{ secrets.CZI_RELEASE_PLEASE_PK }}

- name: release please
uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: simple
bump-minor-pre-major: true
changelog-types: ${{ steps.configure-changelog.outputs.result }}
token: ${{ steps.generate_token.outputs.token }}

- uses: actions/checkout@v2
# we need to fetch all history and tags
# so we build the proper version
with:
fetch-depth: 0
if: ${{ steps.release.outputs.release_created }}

- uses: actions/setup-go@v2
with:
go-version: 1.17
if: ${{ steps.release.outputs.release_created }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
if: ${{ steps.release.outputs.release_created }}
7 changes: 0 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
before:
hooks:
- make clean

builds:
- binary: fogg
env:
Expand All @@ -23,9 +19,6 @@ archives:
release:
prerelease: false

env_files:
github_token: ~/.config/goreleaser/github_token

brews:
- description: 'Terraform without pain.'
tap:
Expand Down
19 changes: 0 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,6 @@ lint-all: lint-setup ## run the fast go linters

TEMPLATES := $(shell find templates -not -name "*.go")

release: setup ## run a release
./bin/bff bump
git push
goreleaser release
.PHONY: release

release-prerelease: setup ## release to github as a 'pre-release'
go build ${LDFLAGS} .
version=`./fogg version`; \
git tag v"$$version"; \
git push; \
git push origin v"$$version";
goreleaser release -f .goreleaser.prerelease.yml --debug
.PHONY: release-prerelease

release-snapshot: setup ## run a release
goreleaser release --snapshot
.PHONY: release-snapshot

build: fmt ## build the binary
go build ${LDFLAGS} .
.PHONY: build
Expand Down
9 changes: 0 additions & 9 deletions codecov.yml

This file was deleted.

0 comments on commit 02584d2

Please sign in to comment.