Skip to content

Commit

Permalink
Merge pull request #11 from Intility/cicd
Browse files Browse the repository at this point in the history
Set up pipeline to build, test, and release
  • Loading branch information
Callum0x50 authored Nov 4, 2024
2 parents fe19232 + 8dfac7f commit 463c759
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 14 deletions.
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/goreleaser-action@v5.1.0
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

0 comments on commit 463c759

Please sign in to comment.