-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from kenriortega/development
ci: migrate from custom release to goreleaser
- Loading branch information
Showing
3 changed files
with
137 additions
and
49 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 |
---|---|---|
@@ -1,56 +1,56 @@ | ||
name: Release Egosystem proxys binaries | ||
# name: Release Egosystem proxys binaries | ||
|
||
on: | ||
release: | ||
types: [created] | ||
# on: | ||
# release: | ||
# types: [created] | ||
|
||
jobs: | ||
releases-matrix: | ||
name: Release Go Binary | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# build and publish in parallel: linux/amd64,windows/amd64,linux/darwin | ||
goos: [linux,windows,darwin] | ||
goarch: [amd64] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# jobs: | ||
# releases-matrix: | ||
# name: Release Go Binary | ||
# runs-on: ubuntu-latest | ||
# strategy: | ||
# matrix: | ||
# # build and publish in parallel: linux/amd64,windows/amd64,linux/darwin | ||
# goos: [linux,windows,darwin] | ||
# goarch: [amd64] | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
|
||
- name: Set BUILD_TIME env | ||
run: echo BUILD_TIME=$(date --iso-8601=seconds) >> ${GITHUB_ENV} | ||
- name: Set APP_VERSION env | ||
run: echo APP_VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV} | ||
# - name: Set BUILD_TIME env | ||
# run: echo BUILD_TIME=$(date --iso-8601=seconds) >> ${GITHUB_ENV} | ||
# - name: Set APP_VERSION env | ||
# run: echo APP_VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV} | ||
|
||
- uses: wangyoucao577/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
project_path: "./cmd/" | ||
binary_name: "ngonxctl-${{ env.APP_VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}" | ||
ldflags: "-s -X github.com/kenriortega/ngonx/cmd/cli.buildTime=${{env.BUILD_TIME}} -X github.com/kenriortega/ngonx/cmd/cli.versionHash=${{github.sha}} -X github.com/kenriortega/ngonx/cmd/cli.version=${{env.APP_VERSION}}" | ||
# - uses: wangyoucao577/[email protected] | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# goos: ${{ matrix.goos }} | ||
# goarch: ${{ matrix.goarch }} | ||
# project_path: "./cmd/" | ||
# binary_name: "ngonxctl-${{ env.APP_VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}" | ||
# ldflags: "-s -X github.com/kenriortega/ngonx/cmd/cli.buildTime=${{env.BUILD_TIME}} -X github.com/kenriortega/ngonx/cmd/cli.versionHash=${{github.sha}} -X github.com/kenriortega/ngonx/cmd/cli.version=${{env.APP_VERSION}}" | ||
|
||
releases-matrix-arm: | ||
name: Release Go Binary | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# build and publish in parallel: linux/arm | ||
goos: [linux] | ||
goarch: [arm] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# releases-matrix-arm: | ||
# name: Release Go Binary | ||
# runs-on: ubuntu-latest | ||
# strategy: | ||
# matrix: | ||
# # build and publish in parallel: linux/arm | ||
# goos: [linux] | ||
# goarch: [arm] | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
|
||
- name: Set BUILD_TIME env | ||
run: echo BUILD_TIME=$(date --iso-8601=seconds) >> ${GITHUB_ENV} | ||
- name: Set APP_VERSION env | ||
run: echo APP_VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV} | ||
# - name: Set BUILD_TIME env | ||
# run: echo BUILD_TIME=$(date --iso-8601=seconds) >> ${GITHUB_ENV} | ||
# - name: Set APP_VERSION env | ||
# run: echo APP_VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV} | ||
|
||
- uses: wangyoucao577/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
project_path: "./cmd/" | ||
binary_name: "ngonxctl-${{ env.APP_VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}" | ||
ldflags: "-s -X github.com/kenriortega/ngonx/cmd/cli.buildTime=${{env.BUILD_TIME}} -X github.com/kenriortega/ngonx/cmd/cli.versionHash=${{github.sha}} -X github.com/kenriortega/ngonx/cmd/cli.version=${{env.APP_VERSION}}" | ||
# - uses: wangyoucao577/[email protected] | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# goos: ${{ matrix.goos }} | ||
# goarch: ${{ matrix.goarch }} | ||
# project_path: "./cmd/" | ||
# binary_name: "ngonxctl-${{ env.APP_VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}" | ||
# ldflags: "-s -X github.com/kenriortega/ngonx/cmd/cli.buildTime=${{env.BUILD_TIME}} -X github.com/kenriortega/ngonx/cmd/cli.versionHash=${{github.sha}} -X github.com/kenriortega/ngonx/cmd/cli.version=${{env.APP_VERSION}}" |
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,29 @@ | ||
name: goreleaser | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: -f .goreleaser.yml release --rm-dist | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
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: | ||
- | ||
# ID of the build. | ||
# Defaults to the project name. | ||
id: "ngonx" | ||
|
||
# Path to project's (sub)directory containing Go code. | ||
# This is the working directory for the Go build command(s). | ||
# Default is `.`. | ||
# dir: go | ||
|
||
# Path to main.go file or main package. | ||
# Notice: when used with `gomod.proxy`, this must be a package. | ||
# | ||
# Default is `.`. | ||
main: ./cmd/cli | ||
|
||
# Binary name. | ||
# Can be a path (e.g. `bin/app`) to wrap the binary in a directory. | ||
# Default is the name of the project directory. | ||
binary: ngonxctl | ||
|
||
# Custom ldflags templates. | ||
# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`. | ||
ldflags: | ||
- -s -w -X cli.version={{.Version}} -X cli.versionHash={{.Commit}} -X cli.buildTime={{.Date}} | ||
|
||
|
||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |