Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
Add a github action to release automatically when tagging the repo. (#…
Browse files Browse the repository at this point in the history
…482)

* Add release github actions
  • Loading branch information
cyriltovena authored Jan 17, 2023
1 parent 93ee5c9 commit 27bb8d1
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 2 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: goreleaser

on:
push:
# run only against tags
tags:
- "v*"
permissions:
contents: write
packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set GIT_LAST_COMMIT_DATE
run: echo "GIT_LAST_COMMIT_DATE=$(git log -1 --date=iso-strict --format=%cd)" >> $GITHUB_ENV
# Forces goreleaser to use the correct previous tag for the changelog
- name: Set GORELEASER_PREVIOUS_TAG
run: echo "GORELEASER_PREVIOUS_TAG=$(git tag -l --sort=-version:refname | grep -E '^v.*' | head -n 2 | tail -1)" >> $GITHUB_ENV
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: ">=1.19.5"
cache: true
# setup docker buildx
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# login to docker hub
- uses: docker/login-action@v2
name: Login to Docker Hub
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro'
# distribution:
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
17 changes: 17 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,23 @@ changelog:
- "^test:"
release:
draft: true
footer: |
As always, feedbacks are more than welcome, feel free to open issues/discussions.
You can reach out to the team using:
- [Slack](https://grafana.slack.com/archives/C047CCW6YM8)
- [Github Discussions](https://github.com/grafana/phlare/discussions)
- [Github Issues](https://github.com/grafana/phlare/issues)
- [Mailing List](https://groups.google.com/g/phlare-team)
## Docker Images
- [grafana/phlare](https://hub.docker.com/r/grafana/phlare/tags)
```bash
docker pull docker.io/grafana/phlare:{{ trimprefix .Tag "v" }}
```
ids:
- phlare
- profilecli
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ build: go/bin
.PHONY: release
release/prereq: $(BIN)/goreleaser ## Ensure release pre requesites are met
# remove local git tags coming from helm chart release
git tag -d $(shell git tag -l "phlare-*")
git tag -d $(shell git tag -l "phlare-*" "api/*")
# ensure there is a docker cli command
@which docker || { apt-get update && apt-get install -y docker.io; }
@docker info > /dev/null
Expand Down Expand Up @@ -251,7 +251,7 @@ $(BIN)/updater: Makefile

$(BIN)/goreleaser: Makefile go.mod
@mkdir -p $(@D)
GOBIN=$(abspath $(@D)) $(GO) install github.com/goreleaser/goreleaser@v1.11.5
GOBIN=$(abspath $(@D)) $(GO) install github.com/goreleaser/goreleaser@v1.14.1

$(BIN)/trunk: Makefile
@mkdir -p $(@D)
Expand Down
14 changes: 14 additions & 0 deletions docs/internal/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Release Process

## Automatic Release Process

To release a new version of the project you need to follow the following steps:

1. Create a new branch for the release (e.g. `release/v0.1.0`)
2. Create tags for the release (e.g. `v0.1.0` and `phlare-0.1.0`)
3. Push the release branch and tags to the remote

The ci will automatically handle the build and create a draft github release.

Once ready, you can edit and publish the draft release on Github.

## Manual Release Process

The release process uses [goreleaser](https://goreleaser.com/scm/github/?h=github#github) and can be configured
using the [.goreleaser.yml](./.goreleaser.yml).

Expand Down

0 comments on commit 27bb8d1

Please sign in to comment.