-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add goreleaser config and release pipeline
- Loading branch information
Omar El Malak
committed
Oct 17, 2024
1 parent
8aa111e
commit 67783c3
Showing
3 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Esegue build snapshot per ogni push su main | ||
tags: | ||
- 'v*' # Esegue una release ufficiale quando il tag inizia con 'v' | ||
|
||
env: | ||
GORELEASER_VERSION: v2.3.2 | ||
|
||
jobs: | ||
build: | ||
name: Build and Release for Supported Architectures | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout del codice | ||
- name: Checkout Repository | ||
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
with: | ||
show-progress: false | ||
|
||
# Setup di Go | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.2' | ||
|
||
# Installazione di GoReleaser | ||
- name: Install GoReleaser | ||
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 | ||
with: | ||
version: ${{ env.GORELEASER_VERSION }} | ||
install-only: true | ||
|
||
# Esecuzione di GoReleaser per snapshot build (su main) | ||
- name: Run GoReleaser (Snapshot) | ||
if: github.ref == 'refs/heads/main' | ||
run: goreleaser release --snapshot --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Esecuzione di GoReleaser per rilasci ufficiali (su tag) | ||
- name: Run GoReleaser (Release) | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
run: goreleaser release --clean --skip-validate --skip-publish=false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Salva i binari come artefatti in snapshot build | ||
- name: Upload artifact (Snapshot) | ||
if: github.ref == 'refs/heads/main' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,4 +129,5 @@ $RECYCLE.BIN/ | |
|
||
mipyconfig.json | ||
environment | ||
config_path.txt | ||
config_path.txt | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
|
||
# The lines below are called `modelines`. See `:help modeline` | ||
# Feel free to remove those if you don't want/need to use them. | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj | ||
|
||
version: 2 | ||
|
||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
|
||
builds: | ||
- main: ./cmd/main.go | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
- "386" | ||
goarm: | ||
- "6" | ||
- "7" | ||
|
||
archives: | ||
- format: binary | ||
name_template: >- | ||
{{ .Binary }}- | ||
{{- .Os }}- | ||
{{- .Arch }}{{ with .Arm }}v{{ . }}{{ end }} | ||
{{- with .Mips }}-{{ . }}{{ end }} | ||
{{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }} | ||
checksum: | ||
name_template: checksums.txt |