Skip to content

Commit e446f66

Browse files
ci: Add GitHub Action for cutting releases. (#41)
1 parent 189afcd commit e446f66

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- 'scip-ruby-v*'
6+
7+
jobs:
8+
create-release:
9+
name: 'Create release'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Create Release Step
14+
id: create_release
15+
run: |
16+
TAG="${GITHUB_REF/refs\/tags\//}"
17+
TITLE="$(echo "$TAG" | sed 's/-v/ v/')"
18+
gh release create "$TAG" --title "$TITLE"
19+
env:
20+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
build-and-upload-artifacts:
23+
name: 'Build and upload artifacts'
24+
needs: create-release
25+
strategy:
26+
matrix:
27+
platform: [ubuntu-latest, macos-latest]
28+
runs-on: ${{ matrix.platform }}
29+
env:
30+
TAG: ${{ github.event.ref }}
31+
steps:
32+
- uses: actions/checkout@v3
33+
- name: Install Bazel
34+
run: |
35+
if ! which bazelisk; then
36+
sudo npm install --location=global @bazel/bazelisk
37+
fi
38+
- name: Identify OS
39+
run: |
40+
case "$(uname -s)" in
41+
Linux*) os="linux";;
42+
Darwin*) os="darwin";;
43+
*) echo "Unhandled OS type" && exit 1;;
44+
esac
45+
echo "os=$os" >> "$GITHUB_ENV"
46+
- name: Run debug build
47+
run: bazel build //main:scip-ruby --config=dbg
48+
- name: Upload debug binary
49+
run: |
50+
debugBinaryPath="scip-ruby-debug-$osname-$(uname -m)"
51+
mv "bazel-out/$os-dbg/bin/main/scip-ruby" "$debugBinaryPath"
52+
gh release upload "${GITHUB_REF/refs\/tags\//}" "$debugBinaryPath"
53+
env:
54+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
- name: Run release build
56+
run: bazel build //main:scip-ruby
57+
- name: Upload release binary
58+
run: |
59+
releaseBinaryPath="scip-ruby-$osname-$(uname -m)"
60+
mv "bazel-out/$osname-fastbuild/bin/main/scip-ruby" "$releaseBinaryPath"
61+
gh release upload "${GITHUB_REF/refs\/tags\//}" "$releaseBinaryPath"
62+
env:
63+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)