-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update GoReleaser config and CI pipelines (#57)
* build: use go1.20 Signed-off-by: Akshay Gaikwad <[email protected]> * ci: update goreleaser * Remove deprecated archives.replacements from goreleaser config * Zip archives for Windows * Run goreleaser for main branch Signed-off-by: Akshay Gaikwad <[email protected]> * ci: update go workflow * Remove Go private module step * Get go version from go.mod file Signed-off-by: Akshay Gaikwad <[email protected]> * ci: release pipeline for pull requests Signed-off-by: Akshay Gaikwad <[email protected]> --------- Signed-off-by: Akshay Gaikwad <[email protected]>
- Loading branch information
Showing
5 changed files
with
67 additions
and
70 deletions.
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 |
---|---|---|
|
@@ -6,15 +6,11 @@ on: | |
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
GOPRIVATE: https://github.com/paralus | ||
|
||
jobs: | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.17.x] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
|
@@ -23,22 +19,20 @@ jobs: | |
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
# Getting go version from the go.mod file | ||
go-version-file: 'go.mod' | ||
|
||
- name: Format | ||
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi | ||
- run: go version | ||
|
||
- name: Granting private modules access | ||
run: | | ||
git config --global url."https://${{ secrets.TOKEN }}:[email protected]/paralus".insteadOf "https://github.com/paralus" | ||
- name: Check code format | ||
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi | ||
|
||
- name: Test all | ||
run: go test -v ./... | ||
|
||
# golangci: | ||
# strategy: | ||
# matrix: | ||
# go-version: [1.17.x] | ||
# os: [ubuntu-latest] | ||
# runs-on: ${{ matrix.os }} | ||
# steps: | ||
|
@@ -47,11 +41,10 @@ jobs: | |
# - name: Set up Go | ||
# uses: actions/setup-go@v4 | ||
# with: | ||
# go-version: ${{ matrix.go-version }} | ||
# # Getting go version from the go.mod file | ||
# go-version-file: 'go.mod' | ||
|
||
# - name: Granting private modules access | ||
# run: | | ||
# git config --global url."https://${{ secrets.TOKEN }}:[email protected]/paralus".insteadOf "https://github.com/paralus" | ||
# - run: go version | ||
|
||
# - name: golangci-lint | ||
# uses: golangci/golangci-lint-action@v2 | ||
|
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 |
---|---|---|
@@ -1,49 +1,58 @@ | ||
name: goreleaser | ||
name: GoReleaser | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: [ 'v*.*.*' ] | ||
|
||
pull_request: | ||
branches: [ main ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
|
||
goreleaser: | ||
release: | ||
strategy: | ||
matrix: | ||
go-version: [1.17.x] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
fetch-depth: 0 # It is required for GoReleaser to work properly. | ||
|
||
# This is needed if you use fields like TagBody, TagSubject or | ||
# TagContents in your templates. | ||
- name: Fetch all tags | ||
run: git fetch --force --tags | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
# Getting go version from the go.mod file | ||
go-version-file: 'go.mod' | ||
|
||
- name: vendor packages | ||
run: go mod tidy -compat=1.17 && go mod vendor | ||
- run: go version | ||
|
||
# Sanity check before publishing | ||
- name: Test all | ||
run: go test -v ./... | ||
|
||
- name: Set goreleaser snapshot env | ||
run: if [[ $GITHUB_REF != refs/tags/v* ]]; then echo "goreleaser_snapshot=--snapshot"; fi >> $GITHUB_ENV | ||
|
||
- name: Read variables | ||
run: | | ||
echo "goreleaser_snapshot=${{ env.goreleaser_snapshot }}" | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # V4.3.0 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
args: release --clean ${{ env.goreleaser_snapshot }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
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