-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (84 loc) · 2.93 KB
/
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
name: Rust
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build-and-test:
name: Build and Test
runs-on: ${{ matrix.target.runs-on }}
strategy:
matrix:
target:
- name: linux-amd64
runs-on: ubuntu-20.04
extension: ""
# - name: windows-amd64
# runs-on: windows-2019
# extension: .exe
- name: osx-amd64
runs-on: macos-13
extension: ""
- name: osx-arm64
runs-on: macos-14
extension: ""
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up bazelrc
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
echo "build:ci --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" >> ~/.bazelrc
echo "startup --output_base=$RUNNER_TEMP/.bazel/output_base" >> ~/.bazelrc
- uses: actions/cache@v4
with:
path: |
${{ runner.temp }}/.bazel/output_base/external
key: bazel-${{ matrix.target.name }}-${{ github.ref }}
restore-keys:
bazel-${{ matrix.target.name }}-refs/heads/master
- name: Build & Test
run: |
INVOCATION_ID="$(uuidgen)"
echo "[View on BuildBuddy](https://bazel-lsp.buildbuddy.io/invocation/$INVOCATION_ID)" >> $GITHUB_STEP_SUMMARY
bazel test //... -c opt --config=ci --invocation_id="$INVOCATION_ID"
- uses: actions/upload-artifact@v4
with:
name: bazel-lsp-${{ matrix.target.name }}${{ matrix.target.extension }}
path: bazel-bin/bazel-lsp${{ matrix.target.extension }}
release:
name: Release
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
release-type: rust
if: github.ref == 'refs/heads/master'
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: releases
pattern: bazel-lsp-*
- name: Rename artifacts
run: |
version=${{ steps.release.outputs.major || 0 }}.${{ steps.release.outputs.minor || 0 }}.${{ steps.release.outputs.patch || 0 }}
files="$(find releases -type f)"
for file in $files; do
basename="$(basename $file)"
extension="${basename/bazel-lsp/}"
dirname="$(dirname $file)"
mv "$file" "${dirname/bazel-lsp-/bazel-lsp-${version}-}${extension}"
rmdir "$dirname"
done
- name: Show Release Artifacts
run: find releases
- name: Upload Release Artifacts
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
run: gh release upload ${{ steps.release.outputs.tag_name }} ./releases/*