-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: github actions for release workflow
- Loading branch information
1 parent
418b593
commit 7d2c224
Showing
4 changed files
with
109 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build-binary: | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest, macos-14, macos-13] | ||
arch: [amd64, arm64] | ||
include: | ||
- os: ubuntu-latest | ||
goos: linux | ||
platform: linux | ||
- os: macos-13 | ||
goos: darwin | ||
platform: darwin | ||
- os: macos-14 | ||
goos: darwin | ||
platform: darwin | ||
exclude: | ||
- os: macos-14 | ||
arch: amd64 | ||
- os: macos-13 | ||
arch: arm64 | ||
name: Building fwatcher-${{ matrix.platform }}-${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: nxtcoder17/actions/setup-cache-go@v1 | ||
with: | ||
cache_key: "fwatcher" | ||
working_directory: . | ||
|
||
# it will set 2 env variables | ||
# IMAGE_TAG - image tag | ||
# OVERRIDE_PUSHED_IMAGE - if true, it will not use pushed image tag | ||
- uses: nxtcoder17/actions/generate-image-tag@v1 | ||
id: tag_name | ||
|
||
- uses: nxtcoder17/actions/setup-nix-cachix@v1 | ||
with: | ||
flake_lock: "./flake.lock" | ||
nix_develop_arguments: ".#default" | ||
cachix_cache_name: ${{ secrets.CACHIX_CACHE_NAME }} | ||
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
|
||
- name: Build Binary | ||
run: |+ | ||
task build version=${IMAGE_TAG} GOOS=${{matrix.goos}} GOARCH=${{matrix.arch}} upx=${{ matrix.platform == 'linux' }} | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: fwatcher-${{ matrix.platform }}-${{ matrix.arch }} | ||
path: bin/* | ||
|
||
release: | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
needs: build-binary | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ${{ github.workspace }}/binaries | ||
pattern: "fwatcher-*" | ||
|
||
- name: listing all artifacts | ||
shell: bash | ||
run: |+ | ||
ls -lah ${{ github.workspace }}/binaries | ||
- uses: nxtcoder17/actions/generate-image-tag@v1 | ||
id: tag_name | ||
|
||
- name: upload to github release | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: |+ | ||
gh release upload $IMAGE_TAG -R ${{github.repository}} ${{github.workspace}}/binaries/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,11 @@ | |
|
||
go_1_22 | ||
upx | ||
go-task | ||
]; | ||
|
||
shellHook = '' | ||
# ''; | ||
''; | ||
}; | ||
} | ||
); | ||
|
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