From 3f6a92eb42b72427c5a5a933b57de52a97502b69 Mon Sep 17 00:00:00 2001 From: Miha Lunar Date: Mon, 25 Nov 2024 21:19:32 +0100 Subject: [PATCH] Replace goreleaser workflow with taskfile --- .github/workflows/release.yml | 57 ++++++++++++----------------------- Taskfile.yml | 43 +++++++++++++------------- go.mod | 6 ++-- go.sum | 18 ++++++----- 4 files changed, 55 insertions(+), 69 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 141ebaa..00fb120 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: goreleaser +name: release on: push: @@ -12,58 +12,41 @@ permissions: packages: write jobs: - goreleaser: + release: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version-file: 'go.mod' - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '20' - - name: Install just - uses: extractions/setup-just@v1 + - name: Install taskfile + run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin - - name: Download assets - run: just assets - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Check dependencies & generated files + run: task check + - name: Build/download dependencies + run: task deps - - name: Set up QEMU for Multiarch Builds - uses: docker/setup-qemu-action@v3 + - name: Build one platform + run: | + GOOS=linux GOARCH=amd64 OUTPUT=./photofield task build:binary + ./photofield -version + rm ./photofield - - name: Run GoReleaser (Push) - if: github.event_name == 'push' - uses: goreleaser/goreleaser-action@v4 - with: - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Build & package all platforms + run: | + task archive:all checksums - - name: Run GoReleaser (PR) - if: github.event_name == 'pull_request' - uses: goreleaser/goreleaser-action@v4 - with: - distribution: goreleaser - version: latest - args: release --snapshot --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Taskfile.yml b/Taskfile.yml index f20c7c2..7bd89b2 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -41,14 +41,6 @@ tasks: cmds: - task --list-all - package: - deps: - - task: tidy - - task: gen - - task: build:deps - - task: archive:all - - task: checksums - added: { cmds: [changie new -k Added -e] } deprecated: { cmds: [changie new -k Deprecated -e] } removed: { cmds: [changie new -k Removed -e] } @@ -74,10 +66,11 @@ tasks: cmds: - cat .changes/$(changie latest).md - release:push: - cmds: - - task: package - - task: docker:multiarch:push + package: + deps: + - task: build:deps + - task: archive:all + - task: checksums release:local: cmds: @@ -89,9 +82,21 @@ tasks: - task: package - task: docker:multiarch:push:local + check: + cmds: + - task: tidy + - git diff --exit-code go.mod go.sum + - task: gen + - git diff --exit-code + tidy: go mod tidy gen: go generate -x + deps: + deps: + - task: assets + - task: build:deps + build:deps: deps: - build:docs @@ -124,7 +129,6 @@ tasks: assets: dir: data/geo - silent: true vars: EMBED_GO: ../../embed-geo.go GPKG_FILE: @@ -136,13 +140,11 @@ tasks: status: - test -f "{{.GPKG_FILE}}" cmds: - - | - # gpkg_file="$(grep -e '//go:embed data/geo/' ../../embed-geo.go | cut -d / -f 5)" - # gpkg_ver="$(grep -e '// tinygpkg-data release:' ../../embed-geo.go | cut -d ' ' -f 4)" - # gpkg_dst="$gpkg_file" - echo "downloading tinygpkg-data/{{ .GPKG_VER }}/{{ .GPKG_FILE }}" - wget -q -O "{{ .GPKG_FILE }}" https://github.com/SmilyOrg/tinygpkg-data/releases/download/{{ .GPKG_VER }}/{{ .GPKG_FILE }} - echo "downloaded to $PWD/{{ .GPKG_FILE }}" + - silent: true + cmd: | + echo "downloading tinygpkg-data/{{ .GPKG_VER }}/{{ .GPKG_FILE }}" + wget -q -O "{{ .GPKG_FILE }}" https://github.com/SmilyOrg/tinygpkg-data/releases/download/{{ .GPKG_VER }}/{{ .GPKG_FILE }} + echo "downloaded to $PWD/{{ .GPKG_FILE }}" run: cmds: @@ -196,7 +198,6 @@ tasks: OUTPUT="${OUTPUT}.exe" fi echo $OUTPUT - silent: true build:binary: requires: diff --git a/go.mod b/go.mod index 9cc8f44..9847832 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/golang-migrate/migrate/v4 v4.15.0-beta.1 github.com/golang/geo v0.0.0-20230421003525-6adc56603217 github.com/gosimple/slug v1.10.0 - github.com/grafana/pyroscope-go v1.1.0 + github.com/grafana/pyroscope-go v1.2.0 github.com/hako/durafmt v0.0.0-20200605151348-3a43fc422dd9 github.com/imdario/mergo v0.3.13 github.com/joho/godotenv v1.3.0 @@ -62,13 +62,13 @@ require ( github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd // indirect github.com/google/uuid v1.6.0 // indirect github.com/gosimple/unidecode v1.0.0 // indirect - github.com/grafana/pyroscope-go/godeltaprof v0.1.6 // indirect + github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-multierror v1.1.0 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5 // indirect - github.com/klauspost/compress v1.17.3 // indirect + github.com/klauspost/compress v1.17.8 // indirect github.com/lucasb-eyer/go-colorful v1.0.3 // indirect github.com/mattn/go-colorable v0.1.9 // indirect github.com/mattn/go-isatty v0.0.20 // indirect diff --git a/go.sum b/go.sum index ec7d46d..b70cce2 100644 --- a/go.sum +++ b/go.sum @@ -342,10 +342,10 @@ github.com/gosimple/slug v1.10.0 h1:3XbiQua1IpCdrvuntWvGBxVm+K99wCSxJjlxkP49GGQ= github.com/gosimple/slug v1.10.0/go.mod h1:MICb3w495l9KNdZm+Xn5b6T2Hn831f9DMxiJ1r+bAjw= github.com/gosimple/unidecode v1.0.0 h1:kPdvM+qy0tnk4/BrnkrbdJ82xe88xn7c9hcaipDz4dQ= github.com/gosimple/unidecode v1.0.0/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc= -github.com/grafana/pyroscope-go v1.1.0 h1:Ds35iZ+xyZCx3+sw1qfSbPujSiMeyGvvXoH5BX4+J7Y= -github.com/grafana/pyroscope-go v1.1.0/go.mod h1:Mw26jU7jsL/KStNSGGuuVYdUq7Qghem5P8aXYXSXG88= -github.com/grafana/pyroscope-go/godeltaprof v0.1.6 h1:nEdZ8louGAplSvIJi1HVp7kWvFvdiiYg3COLlTwJiFo= -github.com/grafana/pyroscope-go/godeltaprof v0.1.6/go.mod h1:Tk376Nbldo4Cha9RgiU7ik8WKFkNpfds98aUzS8omLE= +github.com/grafana/pyroscope-go v1.2.0 h1:aILLKjTj8CS8f/24OPMGPewQSYlhmdQMBmol1d3KGj8= +github.com/grafana/pyroscope-go v1.2.0/go.mod h1:2GHr28Nr05bg2pElS+dDsc98f3JTUh2f6Fz1hWXrqwk= +github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg= +github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= github.com/gregjones/httpcache v0.0.0-20170920190843-316c5e0ff04e/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hako/durafmt v0.0.0-20200605151348-3a43fc422dd9 h1:IEhIezS5kcD4ZzOwVl8dAyJ9JCi4Xo6tg44Vj/z7UsI= @@ -449,8 +449,8 @@ github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.17.3 h1:qkRjuerhUU1EmXLYGkSH6EZL+vPSxIrYjLNAK4slzwA= -github.com/klauspost/compress v1.17.3/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -622,14 +622,16 @@ github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7Sr github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tdewolff/canvas v0.0.0-20200504121106-e2600b35c365 h1:iNyEAGvN8yNc5/maTbLhStXRIqp+PSxpjG68KRtU3Y4= github.com/tdewolff/canvas v0.0.0-20200504121106-e2600b35c365/go.mod h1:DCuQBGs+Nm73wH9S/z1tlUKDbAPCGa6W7A/DHU1ENmQ= github.com/tdewolff/minify/v2 v2.7.1-0.20200112204046-70870d25a935 h1:nRG5jPGtwJpQ8KtrqhGVdLAuOnk4YWfNxh4Kx9XMuAw=