Skip to content

Commit

Permalink
Fix goreleaser & revamp CI & repo in general (#402)
Browse files Browse the repository at this point in the history
* Update goreleaser config based on deprecations

* Add goreleaser tests to the CI

* Use --clean instead of --rm-dist

* Fix artifacts upload and update setup-go action

* Stop using our fork of aws-actions/configure-aws-credentials

* Autopublish releases

* Document release procedure in `CONTRIBUTING.md`

* Add Dev Tooling as code owners
  • Loading branch information
dotboris authored Jul 13, 2023
1 parent d998c3c commit c3fecbc
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 35 deletions.
57 changes: 47 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ on:
pull_request:
branches:
- master
jobs:
build:
name: Test
- main

jobs:
test:
permissions:
id-token: write # required for AWS assume role

Expand All @@ -16,16 +16,12 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- name: Setup Go
uses: actions/setup-go@v3
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.17
id: go

- name: Checkout
uses: actions/checkout@v3

- uses: coveooss/configure-aws-credentials-action@v1.7.0
- uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::043612128888:role/nrd-oss-tgf-github-actions-ci
Expand All @@ -34,3 +30,44 @@ jobs:
env:
AWS_REGION: us-east-1
run: go test -v ./...

goreleaser-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.17

- uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757
with:
distribution: goreleaser
version: latest
args: check

goreleaser-test-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # goreleaser needs the whole history to build the release notes
- uses: actions/setup-go@v4
with:
go-version: 1.17

- uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757
with:
distribution: goreleaser
version: latest
args: release --snapshot --clean
env:
CGO_ENABLED: 0

- uses: actions/upload-artifact@v3
with:
name: test-release
path: |
dist/*.zip
dist/*.txt
if-no-files-found: error
retention-days: 5
17 changes: 6 additions & 11 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
name: Build
name: Release on Tag
on:
push:
tags:
- "v*"
jobs:
build:
release:
name: Tag
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: 1.17
id: go

- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 0 # goreleaser needs the whole history to build the release notes

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757
- uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757
with:
distribution: goreleaser
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CGO_ENABLED: 0
1 change: 1 addition & 0 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- master
- main

jobs:
posix:
Expand Down
14 changes: 8 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ builds:
# Archive customization
archives:
- format: zip

replacements:
amd64: 64-bits
darwin: macOS
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- if eq .Os "darwin" }}macOS_
{{- else }}{{ .Os }}_{{ end }}
{{- if eq .Arch "amd64" }}64-bits
{{- else }}{{ .Arch }}{{ end }}
files:
- nothing.*

# GitHub release customization
release:
draft: true
prerelease: true
prerelease: auto
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @coveooss/dev-tooling
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

## Release procedure

1. Find the latest tag
1. Look at changes between now and the current tag
1. Create a tag with the format `vX.Y.Z`

You might be tempted to create a release through GitHub to create the tag.
Don't do that. We have a GitHub workflow in place that will create a release
from tags that get pushed. Create your tag with `git tag`.

1. Push that tag
1. Wait for the [Release on Tag](https://github.com/coveooss/tgf/actions/workflows/tag.yml) to build your release.
1. Find your release and make sure things are as you expect them to be
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ outdated version.

## Installation

On `mac` and `linux`:
On `mac` and `linux`:

You can run the `get-latest-tgf.sh` script to check if you have the latest version of tgf installed and install it as needed:

Expand Down Expand Up @@ -362,10 +362,3 @@ Start a shell `fish` in the current folder

Invokes `my_command` in your own docker image. As you can see, you can do whatever you need to with `tgf`. It is not restricted to only the pre-packaged
Docker images, you can use it to run any program in any Docker images. Your imagination is your limit.

## Development

Builds are automatically launched on tagging.

Tags with the format image-0.0.0 automatically launch a Docker images build that are available through Docker Hub.
Tags with the format v0.0.0 automatically launch a new release on Github for the TGF executable.

0 comments on commit c3fecbc

Please sign in to comment.