Skip to content

Commit

Permalink
ci: auto publish backend binaries
Browse files Browse the repository at this point in the history
Once a new release is published, the new workflow uses Goreleaser to build the binaries and then uploads the assets manually.
  • Loading branch information
IgnisDa authored Oct 25, 2023
1 parent b622bd7 commit a520fff
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 6 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/cli-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CLI

on:
release:
types: [published]

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: stable
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --snapshot
workdir: ./backend
env:
GORELEASER_CURRENT_TAG: 'v0.0.0' # can be anything since we're using --snapshot
- run: |
mkdir -p dist/artifacts
cp dist/*.{tar.gz,zip} dist/artifacts
working-directory: ./backend
- name: Upload assets
uses: softprops/action-gh-release@v1
with:
files: ./backend/dist/artifacts/*
fail_on_unmatched_files: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ e2e/test-results/
e2e/playwright-report/
e2e/playwright/.cache/
/backend/build_info/version.txt

/backend/dist
24 changes: 24 additions & 0 deletions backend/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip
17 changes: 12 additions & 5 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ To get the Hanko backend up and running you need to:
5. [Configure JSON Web Key Set generation](#configure-json-web-key-set-generation)
6. [Configure WebAuthn](#configure-webauthn)
7. [Configure CORS](#configure-cors)
8. [Start the backend](#run-the-backend)
8. [Start the backend](#start-the-backend)

### Run a database

Expand Down Expand Up @@ -327,12 +327,14 @@ endpoints). These can be started separately or in a single command.
docker run --mount type=bind,source=<PATH-TO-CONFIG-FILE>,target=/config/config.yaml -p 8000:8000 -it ghcr.io/teamhanko/hanko:latest serve public
```

> **Note** The `<PATH-TO-CONFIG-FILE>` must be an absolute path to your config file created above.
##### Using pre-built binaries

The service is now available at `localhost:8000`.
Each [GitHub release](https://github.com/teamhanko/hanko/releases) (> 0.9.0) has `hanko`'s binary assets uploaded to it. Alternatively you can use
a tool like [eget](https://github.com/zyedidia/eget) to install binaries from releases on GitHub:

`8000` is the default port for the public API. It can be [customized](./docs/Config.md) in the configuration through
the `server.public.address` option.
```bash
eget teamhanko/hanko
```

##### From source

Expand All @@ -346,6 +348,11 @@ Then run:
./hanko serve public --config <PATH-TO-CONFIG-FILE>
```

> **Note** The `<PATH-TO-CONFIG-FILE>` must be an absolute path to your config file created above.

`8000` is the default port for the public API. It can be [customized](./docs/Config.md) in the configuration through
the `server.public.address` option.

The service is now available at `localhost:8000`.

#### Start the admin API
Expand Down

0 comments on commit a520fff

Please sign in to comment.