This repository was archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (86 loc) · 2.78 KB
/
binary-release.yml
File metadata and controls
91 lines (86 loc) · 2.78 KB
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
85
86
87
88
89
90
91
#
# Copyright (c) 2023 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/whichlicense/cli.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Binary CLI Release
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: write
packages: read
jobs:
generate:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
runs-on: ${{ matrix.os }}-latest
defaults:
run:
working-directory: entrypoint
steps:
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.1'
java-version: '19'
components: 'native-image,js,wasm'
cache: 'gradle'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Generate CLI binary
uses: gradle/gradle-build-action@v2
with:
arguments: nativeCompile
build-root-directory: ./entrypoint
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI: true
- name: Rename linux binary
if: contains(matrix.os, 'ubuntu')
run: mv ./whichlicense ./whichlicense-linux-amd64
working-directory: entrypoint/build/native/nativeCompile
- name: Rename Windows binary
if: contains(matrix.os, 'windows')
run: mv ./whichlicense.exe ./whichlicense-windows-amd64.exe
working-directory: entrypoint/build/native/nativeCompile
- name: Rename macOS binary
if: contains(matrix.os, 'macos')
run: mv ./whichlicense ./whichlicense-darwin-amd64
working-directory: entrypoint/build/native/nativeCompile
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: release-${{ github.sha }}
path: |
./entrypoint/build/native/nativeCompile/whichlicense-linux-amd64
./entrypoint/build/native/nativeCompile/whichlicense-windows-amd64.exe
./entrypoint/build/native/nativeCompile/whichlicense-darwin-amd64
if-no-files-found: error
retention-days: 1
release:
needs: [ generate ]
runs-on: ubuntu-22.04
environment: release
steps:
- name: Download binary artifacts
uses: actions/download-artifact@v3
with:
name: release-${{ github.sha }}
- name: Release binary artifacts
uses: softprops/action-gh-release@v1
with:
files: |
whichlicense-linux-amd64
whichlicense-windows-amd64.exe
whichlicense-darwin-amd64