Skip to content

Commit d4dccef

Browse files
committed
ci: release workflow updates to use nixy
1 parent c822243 commit d4dccef

4 files changed

Lines changed: 53 additions & 18 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,47 @@ jobs:
4040
steps:
4141
- uses: actions/checkout@v4
4242

43+
- uses: nxtcoder17/nixy@feat/github-action
44+
4345
- uses: nxtcoder17/actions/setup-cache-go@v1
4446
with:
4547
cache_key: "run"
4648
working_directory: .
4749

48-
- uses: nxtcoder17/actions/setup-nix-cachix@v1
49-
with:
50-
flake_lock: "./flake.lock"
51-
nix_develop_arguments: ".#default"
52-
cachix_cache_name: ${{ secrets.CACHIX_CACHE_NAME }}
53-
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
50+
# - uses: nxtcoder17/actions/setup-nix-cachix@v1
51+
# with:
52+
# flake_lock: "./flake.lock"
53+
# nix_develop_arguments: ".#default"
54+
# cachix_cache_name: ${{ secrets.CACHIX_CACHE_NAME }}
55+
# cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
5456

5557
- uses: nxtcoder17/actions/metadata@main
5658
id: meta
5759

60+
# - name: Build Binary
61+
# shell: bash
62+
# env:
63+
# VERSION: ${{steps.meta.outputs.version}}
64+
# run: |+
65+
# nixy build runfile
66+
5867
- name: Build Binary
5968
shell: bash
6069
env:
6170
CGO_ENABLED: 0
71+
VERSION: "${{ steps.meta.outputs.version }}.${{ steps.meta.outputs.commit_slug }}"
6272
run: |+
6373
arch_list=("amd64" "arm64")
6474
os_list=("linux" "darwin")
6575
76+
6677
for os in "${os_list[@]}"; do
6778
for arch in "${arch_list[@]}"; do
68-
echo "🚧 building binary for os=$os arch=$arch"
69-
export GOARCH=$arch
7079
export GOOS=$os
80+
export GOARCH=$arch
7181
72-
binary=bin/run-$GOOS-$GOARCH
73-
time go build -o $binary -ldflags="-s -w -X main.Version=${{ steps.meta.outputs.version }}-${{steps.meta.outputs.short_sha}}" -tags urfave_cli_no_docs ./cmd/run
82+
echo "🚧 building binary for os=$GOOS arch=$GOARCH"
83+
go build -o bin/run-${GOOS}-${GOARCH} -ldflags="-s -w -X main.Version=$VERSION" -tags urfave_cli_no_docs ./cmd/run
7484
done
7585
done
7686

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ bin/
44
Taskfile.yml
55
go.work*
66
tags
7+
.nixy

Runfile.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@ tasks:
22
build:
33
env:
44
CGO_ENABLED: 0
5+
GOOS:
6+
sh: go env GOOS
7+
GOARCH:
8+
sh: go env GOARCH
9+
version:
10+
required: true
511
cmd:
612
- |+
713
echo "building ..."
8-
go build -o bin/run -ldflags="-s -w" -tags urfave_cli_no_docs ./cmd/run
14+
go build -o bin/run-${GOOS}-${GOARCH} -ldflags="-s -w -X main.Version=$VERSION" -tags urfave_cli_no_docs ./cmd/run
915
echo "DONE"
1016
1117
build:dev:
18+
watch:
19+
enabled: true
20+
dirs:
21+
- .
1222
cmd:
13-
- |+
14-
echo "building ..."
15-
go build -o bin/run-nightly -ldflags="-s -w" -tags urfave_cli_no_docs ./cmd/run
16-
echo "DONE"
23+
- run: build
24+
env:
25+
version: "nightly"
1726

1827
example:
1928
dir: ./examples

nixy.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,22 @@ packages:
66
- pre-commit
77
- gotestfmt
88

9+
builds:
10+
runfile:
11+
command: |+
12+
echo "VERSION: $VERSION"
913
10-
onShellEnter: |+
11-
export PATH="/workspace/bin:$PATH"
12-
source $HOME/.profile
14+
run build GOOS=linux GOARCH=amd64 version=$VERSION
15+
run build GOOS=linux GOARCH=arm64 version=$VERSION
16+
run build GOOS=darwin GOARCH=amd64 version=$VERSION
17+
run build GOOS=darwin GOARCH=arm64 version=$VERSION
18+
19+
paths:
20+
- ./bin/run-linux-amd64
21+
- ./bin/run-linux-arm64
22+
- ./bin/run-darwin-amd64
23+
- ./bin/run-darwin-arm64
24+
25+
# onShellEnter: |+
26+
# export PATH="/workspace/bin:$PATH"
27+
# # source $HOME/.profile

0 commit comments

Comments
 (0)