Skip to content

Commit

Permalink
build: release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
fntlnz committed Jul 26, 2024
1 parent 7765101 commit 819ac75
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 24 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
- uses: actions/setup-go@v5
with:
registry: public.cr.seqera.io
username: public-cr-admin
password: ${{ secrets.SEQERA_PUBLIC_CR_PASSWORD }}
go-version: "1.22.2"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install GoReleaser
- name: Install goreleaser
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
distribution: goreleaser
install-only: true
- name: Build snapshot
run: make snapshot
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.22.2"
- name: Login to Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: public.cr.seqera.io
username: public-cr-admin
password: ${{ secrets.SEQERA_PUBLIC_CR_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
distribution: goreleaser
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 5 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ builds:
# build container images
dockers:
- image_templates:
- "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}-amd64"
- "public.cr.seqera.io/seqeralabs/staticreg:{{.Tag}}-amd64"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- image_templates:
- "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}-arm64"
- "public.cr.seqera.io/seqeralabs/staticreg:{{.Tag}}-arm64"
use: buildx
build_flag_templates:
- "--pull"
Expand All @@ -28,10 +28,10 @@ dockers:

# merge multi arch image manifests
docker_manifests:
- name_template: "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}"
- name_template: "public.cr.seqera.io/seqeralabs/staticreg:{{.Tag}}"
image_templates:
- "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}-amd64"
- "public.cr.seqera.io/seqeralabs/staticreg:{{ if .IsSnapshot }}{{.ShortCommit}}-snapshot{{ else }}{{ .Tag }}{{ end }}-arm64"
- "public.cr.seqera.io/seqeralabs/staticreg:{{.Tag}}-amd64"
- "public.cr.seqera.io/seqeralabs/staticreg:{{.Tag}}-arm64"
archives:
- format: tar.gz
name_template: >-
Expand Down
23 changes: 14 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,31 @@ make
```


## Manual Release to GitHub
## Release
Releasing is done via GitHub actions.

**NB**: This is only done manually in case the GH action does not work.
To release you need to:

Export a `GITHUB_TOKEN`, generate it from [here](https://github.com/settings/tokens/new?scopes=repo,write:packages) with `write:packages` permissions.
- Bump version in the `VERSION` file (this needs to be a [semver](https://semver.org/) numbers)
- Commit the version file
- Start the release process



**Release**

Bump version in the `VERSION` file (this needs to be a [semver](https://semver.org/) numbers)

**Bump version file**
```bash
git checkout master
echo "<new version>" > VERSION
```

**Commit the version file**
```bash
git commit -am "release: v$(cat VERSION)"
git push
```

Then you can either release:


**Start the release process**

```bash
make release
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ endif

.PHONY: release
release:
git tag -a "v$(VERSION)" -m "v$(VERSION)"
git push origin v$(VERSION)
$(GORELEASER_CMD) release --clean --fail-fast
git tag -a "$(VERSION)" -m "$(VERSION)"
git push origin $(VERSION)

.PHONY: snapshot
snapshot:
Expand Down

0 comments on commit 819ac75

Please sign in to comment.