Release (Dry Run) #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Release (Dry Run)' # This name is used by the publish-docker workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
fakeVersion: | |
description: 'Fake version to use (format: vM.N.P.blah, do not use dashes)' | |
required: true | |
default: 'v0.0.0.pre.testing' | |
type: string | |
jobs: | |
build-and-upload-artifacts: | |
name: 'Build and upload artifacts' | |
strategy: | |
matrix: | |
# Use macos-14 as macos-13 runner is only offered for x86_64 | |
platform: ['ubuntu-20.04-16core-graph-team', 'macos-13-xlarge'] | |
config: ['asserts', 'release'] | |
runs-on: ${{ matrix.platform }} | |
env: | |
FAKE_VERSION: ${{ inputs.fakeVersion }} | |
steps: | |
- uses: actions/checkout@v4 | |
# Keep in sync with ci.yml | |
- uses: ruby/setup-ruby@v1 | |
- name: Manually evict cache entry if applicable | |
if: ${{ runner.os == 'Linux' }} | |
run: ACCESS_TOKEN='${{ secrets.GITHUB_TOKEN }}' python3 .github/workflows/evict.py | |
- name: "π Mount Bazel build cache" | |
if: ${{ runner.os == 'Linux' }} | |
uses: actions/cache@v4 | |
with: | |
path: ~/bazelcache/build | |
key: bazel-build-${{ runner.os }}-${{ github.sha }} | |
restore-keys: | | |
bazel-build-${{ runner.os }}- | |
bazel-build- | |
- name: "π Mount Bazel repo cache" | |
uses: actions/cache@v4 | |
if: ${{ runner.os == 'Linux' }} | |
with: | |
path: ~/bazelcache/repos | |
key: bazel-repos-${{ runner.os }}-${{ hashFiles('WORKSPACE') }} | |
restore-keys: | | |
bazel-repos-${{ runner.os }}- | |
bazel-repos- | |
- name: "βοΈ Setup Bazel" | |
run: | | |
echo "rbenv=$(command -v rbenv)" | |
echo "version=${FAKE_VERSION/v/}" | |
VERSION="${FAKE_VERSION/v/}" .github/workflows/setup-bazel.sh | |
echo "--- .bazelrc.local contents ---" | |
cat .bazelrc.local | |
echo "--- end of .bazelrc.local" | |
- name: "π Identify OS" | |
run: echo "OS=$(uname -s | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" | |
- name: ${{ format('π Build ({0})', matrix.config) }} | |
run: | | |
CONFIG="dev" | |
if [ "$CFG" == "release" ]; then | |
CONFIG="release-${OS/darwin/mac}" | |
fi | |
./bazel build //main:scip-ruby --config="$CONFIG" --execution_log_binary_file=log | |
echo "config=$CONFIG" >> "$GITHUB_ENV" | |
env: | |
OS: ${{ env.OS }} | |
CFG: ${{ matrix.config }} | |
- name: ${{ format('πͺ Rename binary ({0})', matrix.config) }} | |
run: | | |
SUFFIX="-asserts" | |
if [ "$CFG" == "release" ]; then | |
SUFFIX="" | |
fi | |
outBinaryPath="scip-ruby${SUFFIX}-$(uname -m)-$OS" | |
cp bazel-bin/main/scip-ruby "$outBinaryPath" | |
echo "outBinaryPath=$outBinaryPath" >> "$GITHUB_ENV" | |
echo "suffix=$SUFFIX" >> "$GITHUB_ENV" | |
env: | |
OS: ${{ env.OS }} | |
CFG: ${{ matrix.config }} | |
- name: ${{ format('π¦ Store binary ({0})', matrix.config) }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-binary-${{ matrix.platform }}-${{ matrix.config }} | |
path: ${{ env.outBinaryPath }} | |
retention-days: 2 | |
- name: ${{ format('π Build Gem(s) ({0})', matrix.config) }} | |
run: ./bazel build //gems/scip-ruby --config="${{ env.config }}" | |
- name: ${{ format('π¦ Store Gem(s) to GitHub ({0})', matrix.config) }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-gem-${{ matrix.platform }}-${{ matrix.config }} | |
path: bazel-bin/gems/scip-ruby/*.gem | |
retention-days: 2 | |
create-release: | |
name: 'Create release (dry run)' | |
needs: build-and-upload-artifacts | |
runs-on: 'ubuntu-20.04' | |
env: | |
FAKE_VERSION: ${{ inputs.fakeVersion }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Release | |
run: | | |
TAG="$FAKE_VERSION" | |
TITLE="scip-ruby $FAKE_VERSION" | |
TEMPLATE="$(< .github/workflows/release-template.md)" | |
echo "${TEMPLATE//TAG_PLACEHOLDER/$TAG}" > notes | |
echo "Create release: tag=$TAG, title=$TITLE" | |
- name: 'π₯ Download all artifacts' | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-* | |
path: release-artifacts | |
merge-multiple: true | |
- name: 'π€ List artifacts for release' | |
run: ls ./release-artifacts/** |