-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (73 loc) · 2.13 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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-github@v1
with:
flake_lock: "./flake.lock"
nix_develop_arguments: ".#default"
- name: Build Binary
run: |+
task build version=${IMAGE_TAG} GOOS=${{matrix.goos}} GOARCH=${{matrix.arch}}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: fwatcher-${IMAGE_TAG}-${{ 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@v3
with:
path: ${{ github.workspace }}/artifacts
- uses: nxtcoder17/actions/generate-image-tag@v1
id: tag_name
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: ${{ github.workspace }}/artifacts/*
tag_name: ${{ steps.tag_name.outputs.TAG_NAME }}
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}