Skip to content

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

[ci] Automatically create release when pushing to main

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

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPAL_RPC_CREDENTIALS: ${{ secrets.OPAL_RPC_CREDENTIALS }}
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: bazel build //...
publish:
runs-on: ubuntu-latest
needs:
- test

Check failure on line 28 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/main.yml (Line: 28, Col: 9): Job 'publish' depends on unknown job 'test'.
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Create release
env:
GIT_AUTHOR_NAME: "EngFlow"
GIT_AUTHOR_EMAIL: "[email protected]"
GIT_COMMITTER_NAME: "EngFlow"
GIT_COMMITTER_EMAIL: "[email protected]"
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 -m "Release ${VERSION}"
# 3. Push release tag.
git tag "${VERSION}" "HEAD"
git push origin "${VERSION}"