diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..85c7f2cc3 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4a4a66faf..df915482c 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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 diff --git a/Makefile b/Makefile index 1ec6f18ec..cf20312d7 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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) diff --git a/docs/internal/RELEASE.md b/docs/internal/RELEASE.md index 02f9006d9..b4ccd2501 100644 --- a/docs/internal/RELEASE.md +++ b/docs/internal/RELEASE.md @@ -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).