-
Notifications
You must be signed in to change notification settings - Fork 1
177 lines (171 loc) · 6.38 KB
/
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Perform Release
on:
push:
branches:
- main
- wip/macos
pull_request:
workflow_dispatch:
inputs:
version:
description: 'The release version'
required: true
type: string
jobs:
make-linux-binary:
strategy:
matrix:
os: [ubuntu-20.04]
include:
- os: ubuntu-20.04
platform: linux-ubuntu-20.04
uploaded_filename: bsp4bazel-x86_64-pc-linux
name: Make binaries for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Print version
run: |
echo Performing release for ${{ inputs.version }}
- name: Setup Windows C++ toolchain
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-2019' }}
- uses: VirtusLab/scala-cli-setup@main
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '17'
components: 'native-image'
cache: 'sbt'
# Update version in build.sbt first, as that gets backed into the native-image (via sbt-buildinfo)
- name: Update version
if: github.event_name == 'workflow_dispatch'
run: scala-cli .github/ci_scripts/updateVersion.scala -- build.sbt "^val bsp4BazelVersion" ${{ inputs.version }}
- name: Build native image
shell: bash
run: |
sbt clean compile graalvm-native-image:packageBin
./.github/ci_scripts/prepare_output.sh target/graalvm-native-image/bsp4bazel staging ${{ matrix.uploaded_filename }}
- name: Upload binary
uses: actions/upload-artifact@v4
with:
path: staging
name: ${{ matrix.uploaded_filename }}
native-image-macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macOS-12
uploaded_filename: bsp4bazel-x86_64-apple-darwin
- os: macOS-14
uploaded_filename: bsp4bazel-aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
- name: Print version
run: |
echo Performing release for ${{ inputs.version }}
- uses: VirtusLab/scala-cli-setup@main
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '17'
components: 'native-image'
cache: 'sbt'
# Update version in build.sbt first, as that gets backed into the native-image (via sbt-buildinfo)
- name: Update version
if: github.event_name == 'workflow_dispatch'
run: scala-cli .github/ci_scripts/updateVersion.scala -- build.sbt "^val bsp4BazelVersion" ${{ inputs.version }}
# macOS image is missing sbt
- name: Build native image
shell: bash
run: |
mkdir -p "$HOME/bin/"
curl -sL https://raw.githubusercontent.com/sbt/sbt/v1.9.9/sbt > "$HOME/bin/sbt"
export PATH="$PATH:$HOME/bin"
chmod +x "$HOME/bin/sbt"
sbt clean compile graalvm-native-image:packageBin
./.github/ci_scripts/prepare_output.sh target/graalvm-native-image/bsp4bazel staging ${{ matrix.uploaded_filename }}
- uses: actions/upload-artifact@v4
with:
path: staging
name: ${{ matrix.uploaded_filename }}
native-image-universal-macos:
needs: native-image-macos
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macOS-12
uploaded_filename: bsp4bazel-universal-apple-darwin
steps:
- uses: actions/checkout@v4
# Download the aritfacts produced in the preceeding jobs
- name: Download binaries
uses: actions/download-artifact@v4
with:
path: staging
- name: Display structure of downloaded files
run: ls -R staging
- name: Build universal binary
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p target
lipo -create -o "target/bsp4bazel" "staging/bsp4bazel-x86_64-apple-darwin/bsp4bazel-x86_64-apple-darwin" "staging/bsp4bazel-aarch64-apple-darwin/bsp4bazel-aarch64-apple-darwin"
./.github/ci_scripts/prepare_output.sh "target/bsp4bazel" staging ${{ matrix.uploaded_filename }}
- uses: actions/upload-artifact@v4
with:
path: staging
name: ${{ matrix.uploaded_filename }}
make_release:
if: github.event_name == 'workflow_dispatch'
name: Make release
needs: [make-linux-binary, native-image-universal-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: "repo"
- uses: VirtusLab/scala-cli-setup@main
# Download the aritfacts produced in the preceeding jobs
- name: Download binaries
uses: actions/download-artifact@v4
with:
path: staging
- name: Display structure of downloaded files
run: ls -R staging
# Update versions, and shas, in files
- name: Update versions, and shas
working-directory: "repo"
run: |
./.github/ci_scripts/update_all.sh ${{ inputs.version }}
# Push changes back to master
- name: Commit updates
working-directory: "repo"
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "Release ${{ inputs.version }}"
git tag -a -m "Release ${{ inputs.version }}" ${{ inputs.version }}
git push --atomic --follow-tags
- name: "Create release"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ inputs.version }}"
prerelease: false
files: |
staging/bsp4bazel-x86_64-pc-linux/bsp4bazel-x86_64-pc-linux
staging/bsp4bazel-x86_64-pc-linux/bsp4bazel-x86_64-pc-linux.sha256
staging/bsp4bazel-universal-apple-darwin/bsp4bazel-universal-apple-darwin
staging/bsp4bazel-universal-apple-darwin/bsp4bazel-universal-apple-darwin.sha256
staging/bazel_rules.tar.gz
staging/bazel_rules.tar.gz.sha256