-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (109 loc) · 4.13 KB
/
ci-build-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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI Build and Release
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
permissions:
contents: write
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [amd64, arm64]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Install Clojure CLI and Babashka
uses: DeLaGuardo/[email protected]
with:
cli: 'latest'
bb: 'latest'
- name: Run CI Task
run: clojure -T:build ci
- name: Archive build artifact
uses: actions/upload-artifact@v4
with:
name: clj-mergetool-${{ matrix.os }}-${{ matrix.arch }}
path: target/clj-mergetool${{ matrix.os == 'windows-latest' && '.exe' || '' }}
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.event.head_commit.message, 'Release') && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read tag from VERSION file
id: read_tag
run: echo "tag=$(cat resources/VERSION)" >> $GITHUB_OUTPUT
- name: Generate release notes from commit message
id: generate_release_notes
run: echo "${{ github.event.head_commit.message }}" > RELEASE_NOTES.md
# note the artifacts are folders containing artifact
# eg: target/clj-mergetool-linux-amd64/clj-merge-tool
- name: Download build artifacts for Linux amd64
uses: actions/download-artifact@v4
with:
name: clj-mergetool-ubuntu-latest-amd64
path: target/clj-mergetool-linux-amd64
- name: Download build artifacts for Linux arm64
uses: actions/download-artifact@v4
with:
name: clj-mergetool-ubuntu-latest-arm64
path: target/clj-mergetool-linux-arm64
- name: Download build artifacts for Windows amd64
uses: actions/download-artifact@v4
with:
name: clj-mergetool-windows-latest-amd64
path: target/clj-mergetool-windows-amd64.exe
- name: Download build artifacts for Windows arm64
uses: actions/download-artifact@v4
with:
name: clj-mergetool-windows-latest-arm64
path: target/clj-mergetool-windows-arm64.exe
- name: Download build artifacts for macOS amd64
uses: actions/download-artifact@v4
with:
name: clj-mergetool-macos-latest-amd64
path: target/clj-mergetool-macos-amd64
- name: Download build artifacts for macOS arm64
uses: actions/download-artifact@v4
with:
name: clj-mergetool-macos-latest-arm64
path: target/clj-mergetool-macos-arm64
- name: Display structure of downloaded files
run: ls -R target
- name: Rename artifacts
run: |
mv target/clj-mergetool-linux-amd64/clj-mergetool clj-mergetool-linux-amd64
mv target/clj-mergetool-linux-arm64/clj-mergetool clj-mergetool-linux-arm64
mv target/clj-mergetool-windows-amd64.exe/clj-mergetool.exe clj-mergetool-windows-amd64.exe
mv target/clj-mergetool-windows-arm64.exe/clj-mergetool.exe clj-mergetool-windows-arm64.exe
mv target/clj-mergetool-macos-amd64/clj-mergetool clj-mergetool-macos-amd64
mv target/clj-mergetool-macos-arm64/clj-mergetool clj-mergetool-macos-arm64
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.read_tag.outputs.tag }}
body_path: RELEASE_NOTES.md
files: |
clj-mergetool-linux-amd64
clj-mergetool-linux-arm64
clj-mergetool-windows-amd64.exe
clj-mergetool-windows-arm64.exe
clj-mergetool-macos-amd64
clj-mergetool-macos-arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}