-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (87 loc) · 2.9 KB
/
build.yaml
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
92
93
94
95
96
97
98
99
100
101
102
103
name: Build artifacts
on:
push:
tags:
- '*'
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with: { path: "~/.m2", key: "${{ runner.os }}-${{ hashFiles('deps.edn') }}-m2" }
- uses: actions/cache@v4
with:
key: "clojure-${{ runner.os }}-${{ hashFiles('.github/workflows/install-binaries.sh') }}"
path: |
./bin
./lib
- name: Install clj runtime
run: .github/workflows/install-binaries.sh
- name: Add clj runtime to PATH
run: echo "${PWD}/bin" >> $GITHUB_PATH
- name: Run release checks
run: make release_check
create_release:
if: startsWith(github.ref, 'refs/tags/v0') || startsWith(github.ref, 'refs/tags/v1')
runs-on: ubuntu-latest
needs: checks
steps:
- name: version
# need some shenanigans to get simple tag name from repo/tags/tagname ref
run: echo "version=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
id: version
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}
outputs:
# ensure dependent workflows can now get version as
# `needs.release_version.outputs.version`
version: ${{ steps.version.outputs.version }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
build_artifacts:
needs:
- create_release
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- linux-amd64-static.tar.gz
- linux-aarch64-static.tar.gz
- macos-aarch64.tar.gz
- macos-amd64.tar.gz
- windows-amd64.zip
- standalone.jar
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with: { path: "~/.m2", key: "${{ runner.os }}-${{ hashFiles('deps.edn') }}-m2" }
- uses: actions/cache@v4
with:
key: "clojure-${{ runner.os }}-${{ hashFiles('.github/workflows/install-binaries.sh') }}"
path: |
./bin
./lib
- name: Artifact name
run: echo filename=apie-${{ needs.create_release.outputs.version }}-${{ matrix.arch }} >> $GITHUB_OUTPUT
id: artifact
- name: Install clj runtime
run: .github/workflows/install-binaries.sh
- name: Build artifact
run: make ${{ steps.artifact.outputs.filename }}
- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ steps.artifact.outputs.filename }}
asset_name: ${{ steps.artifact.outputs.filename }}
asset_content_type: application/octet-stream