Skip to content

[ci] Automatically create release when pushing to main #26

[ci] Automatically create release when pushing to main

[ci] Automatically create release when pushing to main #26

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
- "yannic-tag-main"
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPAL_RPC_CREDENTIALS: ${{ secrets.OPAL_RPC_CREDENTIALS }}
jobs:
# test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build
# run: bazel build //...
publish:
runs-on: ubuntu-latest
# needs:
# - test
if: github.ref == 'refs/heads/yannic-tag-main'
steps:
- uses: actions/checkout@v4
- name: Create release
run: |
VERSION="v$(date -u '+%Y.%m.%d-%H.%M.%S')"
# 1. Download `buildozer`
curl -o "${RUNNER_TEMP}/buildozer" -L "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-linux-amd64"
chmod +x "${RUNNER_TEMP}/buildozer"
# 2. Update `MODULE.bazel` and commit.
"${RUNNER_TEMP}/buildozer" "set version ${VERSION}" "//MODULE.bazel:engflowapis"
git add "MODULE.bazel"
git commit --author="EngFlow <[email protected]>" -m "Release ${VERSION}"
# 3. Push release tag.
git tag "${VERSION}" "HEAD"
git push origin "${VERSION}"