Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add workflow to build, test, and release #11

Merged
merged 10 commits into from
Nov 4, 2024
48 changes: 48 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Build, test, release

on:
release:
types: [published]
workflow_dispatch:


permissions:
contents: write

jobs:
build-test-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Build
run: go build -o bin/indev cmd/indev/main.go

- name: Test
run: go test ./...

- name: GoReleaser Action
uses: goreleaser/[email protected]
with:
args: release --clean --snapshot
version: 2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_REPO_GITHUB_TOKEN: ${{ secrets.TAP_REPO_GITHUB_TOKEN }}
DOWNLOADER_GITHUB_TOKEN: ${{ secrets.DOWNLOADER_GITHUB_TOKEN }}
OTLP_ENDPOINT: ${{ vars.OTLP_ENDPOINT }}
OTLP_TOKEN: ${{ vars.OTLP_TOKEN }}
SENTRY_DSN: ${{ vars.SENTRY_DSN }}
AUTH_AUDIENCE: ${{ vars.AUTH_AUDIENCE }}
AUTH_AUTHORITY: ${{ vars.AUTH_AUTHORITY }}
AUTH_CLIENT_ID: ${{ vars.AUTH_CLIENT_ID }}
AUTH_REDIRECT_URI: ${{ vars.AUTH_REDIRECT_URI }}
PLATFORM_BASE_URI: ${{ vars.PLATFORM_BASE_URI }}
27 changes: 13 additions & 14 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,10 @@ builds:
- windows
- darwin

gitlab_urls:
api: https://gitlab.intility.com/api/v4/
download: https://gitlab.intility.com
use_package_registry: true

release:
gitlab:
owner: "developer-infrastructure/platform-2.0/minato"
name: "indev" #indev
github:
owner: intility
name: indev

archives:
- format: tar.gz
Expand All @@ -80,17 +75,21 @@ archives:
brews:
- name: indev
repository:
owner: homebrew
name: tap
token: "{{ .Env.GITLAB_TOKEN }}"
homepage: https://gitlab.intility.com/developer-infrastructure/platform-2.0/minato/indev
owner: intility
name: homebrew-tap
token: "{{ .Env.TAP_REPO_GITHUB_TOKEN }}"
homepage: https://developers.intility.com
description: "A CLI for managing developer platform resources."
goarm: 6
goamd64: v1
directory: Formula
url_template: https://gitlab.intility.com/api/v4/projects/{{ .Env.CI_PROJECT_ID }}/packages/generic/indev/{{ trimprefix .Tag "v"}}/{{ .ArtifactName }}
# url_template: https://gitlab.intility.com/api/v4/projects/{{ .Env.CI_PROJECT_ID }}/packages/generic/indev/{{ trimprefix .Tag "v"}}/{{ .ArtifactName }}
url_template: "https://github.com/intility/indev/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
url_headers:
- "Authorization: Basic {{ .Env.DOWNLOADER_BASIC_TOKEN }}"
- "Accept: application/octet-stream"
- 'Authorization: bearer #{ENV["DOWNLOADER_GITHUB_TOKEN"]}'
# url_headers:
# - "Authorization: Basic {{ .Env.DOWNLOADER_BASIC_TOKEN }}"
#url_template: "https://gitlab.intility.com/developer-infrastructure/platform-2.0/minato/indev/-/releases/{{ .Tag }}/downloads/{{ .ArtifactName }}"
install: |
bin.install "indev"
Expand Down