-
Notifications
You must be signed in to change notification settings - Fork 244
56 lines (49 loc) · 1.57 KB
/
go.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
name: Go
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: ["linux", "darwin"]
arch: ["amd64", "arm64"]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Build for ${{ matrix.os }}-${{ matrix.arch }}
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
make
tar -C bin -zcf go-ycsb-$GOOS-$GOARCH.tar.gz go-ycsb
- name: Release latest build
uses: softprops/action-gh-release@v1
if: github.event_name == 'push'
with:
name: Latest Build
tag_name: latest-${{ github.sha }}
files: |
*.tar.gz
- name: Clean legacy latest releases
uses: actions/github-script@v6
if: github.event_name == 'push'
with:
script: |
const { owner, repo } = context.repo;
const releases = (await github.rest.repos.listReleases({ owner, repo })).data.filter(r => r.draft && r.tag_name.startsWith('latest'));
for (const r of releases) { await github.rest.repos.deleteRelease({ owner, repo, release_id: r.id }).catch(_ => {}); }
- name: Clean legacy latest tags
if: github.event_name == 'push'
run: |
git tag -l | grep latest | grep -v latest-${{ github.sha }} | xargs -I{} git push -d origin {} || true