From bcbc6eec529cedafd846bd75da8284f3d700c144 Mon Sep 17 00:00:00 2001 From: mirkobrombin Date: Mon, 26 Feb 2024 21:11:30 +0100 Subject: [PATCH] ci: release CI --- .github/workflows/release.yml | 50 ++++++++++++++++++----------------- .goreleaser.yaml | 36 +++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 24 deletions(-) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7372dc1..0612a59 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,35 @@ -name: Go +name: goreleaser on: push: - branches: ["main"] + tags: + - "*" jobs: - build: + goreleaser: runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + upload-artifacts: + runs-on: ubuntu-latest + container: + image: ghcr.io/vanilla-os/pico:main steps: - uses: actions/checkout@v4 @@ -25,26 +48,5 @@ jobs: - uses: softprops/action-gh-release@v1 with: token: "${{ secrets.GITHUB_TOKEN }}" - tag_name: "continuous" - prerelease: true - name: "Continuous Build" files: | dabadee - - - uses: actions/upload-artifact@v4 - with: - name: apx - path: | - dabadee - - sonar: - name: Sonar - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..9392a8a --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,36 @@ +before: + hooks: + - go mod tidy + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + ldflags: + - -s -w -X main.Version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser + +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + format_overrides: + - goos: windows + format: zip +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' \ No newline at end of file