Added CI/CD pipeline

This commit is contained in:
Leon Mika 2025-11-12 22:12:55 +11:00
parent 1f3c11f265
commit 35a953fa97
4 changed files with 261 additions and 0 deletions

View file

@ -0,0 +1,36 @@
name: ci
on:
push:
branches:
- main
- feature/*
jobs:
Build:
runs-on: docker
services:
localstack:
image: localstack/localstack
ports:
- "4566:4566"
env:
SERVICES: ssm,dynamodb
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.25
- name: Configure
run: |
git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika"
- name: Test
run: |
set -xue
go get ./...
go test -p 1 ./...
env:
TEST_DYNAMO_URL: "http://localstack:4566"
GOPRIVATE: "github:com/lmika/*"

View file

@ -0,0 +1,124 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
Build:
runs-on: docker
services:
localstack:
image: localstack/localstack
ports:
- "4566:4566"
env:
SERVICES: ssm,dynamodb
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.25
- name: Configure
run: |
git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika"
- name: Test
run: |
set -xue
go get ./...
go test -p 1 ./...
env:
TEST_DYNAMO_URL: "http://localstack:4566"
GOPRIVATE: "github:com/lmika/*"
# Site:
# needs: Build
# runs-on: docker
# env:
# NETLIFY_SITE_ID: set me
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup Go
# uses: actions/setup-go@v3
# with:
# go-version: 1.24
# - uses: actions/setup-node@v4
# with:
# node-version: 21.1
# - name: Install Hugo
# run: |
# curl -LO https://github.com/gohugoio/hugo/releases/download/v0.146.0/hugo_extended_0.146.0_linux-amd64.deb
# apt install -y ./hugo_extended_0.146.0_linux-amd64.deb
# - name: Install Netlify CLI
# run: |
# npm install netlify-cli@15.0.1 -g
# - name: Build Site
# run: |
# cd _site
# mkdir -p themes
# git clone https://github.com/alex-shpak/hugo-book.git themes/hugo-book
# npm install
# hugo --minify
# - name: Publish Site
# run: |
# cd _site
# netlify deploy --dir docs --prod
'Release MacOS':
# needs: Build
runs-on: macos
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.25
- name: Setup Dependencies
run: |
brew install gpg
- name: Configure
run: |
git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika"
- name: Setup Goreleaser
run: |
go install github.com/goreleaser/goreleaser/v2@v2.12.7
- name: Release
run: |
goreleaser release -f macos.goreleaser.yml --skip=validate --clean
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_PRIVATE_KEY: ${{ secrets.HOMEBREW_TAP_PRIVATE_KEY }}
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
# release-linux:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup Go
# uses: actions/setup-go@v3
# with:
# go-version: 1.22
# - name: Configure
# run: |
# git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika"
# - name: Release
# uses: goreleaser/goreleaser-action@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# version: latest
# args: release -f linux.goreleaser.yml --skip=validate --clean
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# HOMEBREW_GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}

37
linux.goreleaser.yml Normal file
View file

@ -0,0 +1,37 @@
builds:
- id: ted
targets:
- windows_amd64
- linux_amd64
env:
- CGO_ENABLED=1
main: ./cmd/ted/.
binary: dynamo-browse
archives:
- id: zip
builds:
- ted
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
- goos: linux
format: tar.gz
nfpms:
- id: package_nfpms
package_name: audax
builds:
- ted
vendor: lmika
homepage: https://ted.lmika.dev/
maintainer: Leon Mika <lmika@lmika.org>
description: TUI tools for working with CSV files
license: MIT
formats:
- deb
- rpm
bindir: /usr/local/bin
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"

64
macos.goreleaser.yml Normal file
View file

@ -0,0 +1,64 @@
version: 2
builds:
- id: ted
targets:
- darwin_amd64
- darwin_arm64
env:
- CGO_ENABLED=1
main: .
binary: ted
notarize:
macos:
- enabled: true
ids:
- ted
sign:
certificate: "{{.Env.MACOS_SIGN_P12}}"
password: "{{.Env.MACOS_SIGN_PASSWORD}}"
notarize:
issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}"
key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}"
key: "{{.Env.MACOS_NOTARY_KEY}}"
wait: true
timeout: 20m
archives:
- id: tgz
wrap_in_directory: false
formats:
- tar.gz
release:
gitea:
owner: cmd
name: ted
ids:
- tgz
homebrew_casks:
- name: ted
repository:
owner: casks
name: dynamo-browse
git:
url: 'forgejo@lmika.dev:casks/ted.git'
private_key: "{{ .Env.HOMEBREW_TAP_PRIVATE_KEY }}"
directory: Casks
homepage: https://ted.lmika.dev/
description: TUI tools for working with CSV files
license: MIT
checksum:
name_template: 'checksums-macos.txt'
snapshot:
version_template: "{{ .Tag }}-next"
gitea_urls:
api: https://lmika.dev/api/v1
download: https://lmika.dev
# set to true if you use a self-signed certificate
skip_tls_verify: false