-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (76 loc) · 2.29 KB
/
publish.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: Publish
on:
push:
tags:
- '*/v*'
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
# Build with latest version of Go
tools:
name: Tool
needs: create_release
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin]
goarch: [amd64, arm64]
tool:
- cssh/cscp
- cssh/cssh
- clitable/cmd/csvtable
- grepp
- joinlines
- yaml-parse
- password-cache/cmd/password-cache
- cli-bookmarks
- ffind
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.x
cache-dependency-path: "${{ matrix.tool }}/go.sum"
- id: build
name: Build
run: |
go build -v .
dir=$(basename $PWD)
echo "dir: $dir"
echo "binary=$dir" >> $GITHUB_OUTPUT
working-directory: ${{ matrix.tool }}
shell: bash
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Ensure only tools matching the tag are released
if: ${{ (contains(github.ref, steps.build.outputs.binary) || contains(github.ref, 'all')) }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ matrix.tool }}/${{ steps.build.outputs.binary }}
asset_name: ${{ steps.build.outputs.binary }}.${{ matrix.goos }}.${{ matrix.goarch }}
asset_content_type: application/octet-stream