Skip to content

Commit

Permalink
Add releaser workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zivkovicmilos committed Apr 9, 2024
1 parent 1bf67a8 commit f747468
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 41 deletions.
88 changes: 88 additions & 0 deletions .github/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
project_name: tx-indexer

before:
hooks:
- go mod tidy

builds:
- main: ./cmd
binary: tx-indexer
goos:
- linux
- darwin
goarch:
- amd64
- arm64

gomod:
proxy: true

archives:
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
certificate: '${artifact}.pem'
args:
- sign-blob
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
- "--yes" # needed on cosign 2.0.0+
artifacts: checksum
output: true

dockers:
- image_templates:
- "ghcr.io/gnolang/tx-indexer:latest"
- "ghcr.io/gnolang/tx-indexer:{{ .Tag }}"
dockerfile: Dockerfile.release
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"

docker_signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
artifacts: images
output: true
args:
- 'sign'
- '${artifact}'
- "--yes" # needed on cosign 2.0.0+

checksum:
name_template: 'checksums.txt'

changelog:
sort: asc

source:
enabled: true

sboms:
- artifacts: archive
- id: source # Two different sbom configurations need two different IDs
artifacts: source

release:
draft: true
replace_existing_draft: true
prerelease: true
footer: |
### Container Images
https://ghcr.io/gnolang/tx-indexer:{{ .Tag }}
For example:
```
docker pull ghcr.io/gnolang/tx-indexer:{{ .Tag }}
```
38 changes: 0 additions & 38 deletions .github/workflows/docker.yaml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Go Releaser

on:
push:
tags:
- "v*"

permissions:
contents: write # needed to write releases
id-token: write # needed for keyless signing
packages: write # needed for ghcr access

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: 1.21
cache: true

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected]

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --config ./.github/goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ all: build
.PHONY: build
build:
@echo "Building indexer binary"
go build -o build/indexer ./cmd
go build -o build/tx-indexer ./cmd

.PHONY: lint
lint:
Expand Down
4 changes: 2 additions & 2 deletions serve/graph/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ func Setup(s storage.Storage, manager *events.Manager, m *chi.Mux) *chi.Mux {

srv.AddTransport(&transport.Websocket{})

m.Handle("/", playground.Handler("GraphQL playground", "/query"))
m.Handle("/query", srv)
m.Handle("/graphql", playground.Handler("GraphQL playground", "/query"))
m.Handle("/graphql/query", srv)

return m
}

0 comments on commit f747468

Please sign in to comment.