Skip to content

Commit fd6baeb

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

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)