Skip to content

Commit

Permalink
feat(app): new github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
varrcan committed Sep 16, 2022
1 parent 3c1a567 commit 4d730e2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
41 changes: 38 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Go binaries
name: Build and release

on:
push:
Expand All @@ -9,9 +9,44 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up env
run: |
echo binary_path="${GITHUB_WORKSPACE}/bin" >> $GITHUB_ENV
echo binary_name=$(basename "${GITHUB_REPOSITORY}") >> $GITHUB_ENV
echo release_tag=$(basename "${GITHUB_REF}") >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Loading dependencies
run: go mod download

- name: Build binary
run: |
mkdir -p "${{ env.binary_path }}"
TARGETS=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64")
for target in "${TARGETS[@]}"; do
os="$(echo "${target}" | cut -d '/' -f1)"
arch="$(echo "${target}" | cut -d '/' -f2)"
output="${{ env.binary_path }}/${{ env.binary_name }}_${os}_${arch}"
echo "----> Building for: ${target}"
GOOS=${os} GOARCH=${arch} CGO_ENABLED=0 go build -o "${output}"
done
- name: Compress files
run: tar cvfz "${{ env.binary_name }}"-"${{ env.release_tag }}".tar.gz config-files bin

- name: Make release
uses: docker://ghcr.io/local-deploy/build-release:latest
run: hub release create -a "${GITHUB_WORKSPACE}"/"${{ env.binary_name }}"-"${{ env.release_tag }}".tar.gz -m "${{ env.release_tag }}" "${GITHUB_REF}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/varrcan/dl/helper"
)

var version = "0.3.4"
var version = "0.3.5"

func main() {
if !helper.IsConfigDirExists() {
Expand Down

0 comments on commit 4d730e2

Please sign in to comment.