Skip to content

Internal change

Internal change #127

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: "${{ matrix.os }}"
strategy:
fail-fast: false
# Keep in sync with .bcr/{,go/,java/}presubmit.yml
matrix:
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#standard-github-hosted-runners-for-public-repositories
os:
- "ubuntu-22.04"
- "ubuntu-24.04"
- "macos-26"
- "macos-15-intel"
- "windows-2025"
bazel:
- "9.x"
- "8.x"
- "7.x"
- "rolling"
- "last_green"
include:
- repo: "@engflowapis"
path: "."
- repo: "@engflowapis-java"
path: "java"
- repo: "@engflowapis-go"
path: "go"
env:
USE_BAZEL_VERSION: "${{ matrix.bazel }}"
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
- name: "${{ matrix.repo }} Bazel ${{ matrix.bazel }} ${{ matrix.os }}"
run: |
cd "${{ matrix.path }}"
bazel build //...
publish:
runs-on: ubuntu-latest
needs:
- "check"
if: github.ref == 'refs/heads/main'
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
- name: Create tag
id: "tag"
env:
GIT_AUTHOR_NAME: "EngFlow GitHub Automation"
GIT_AUTHOR_EMAIL: "engflow-github-automation+public@engflow.com"
GIT_COMMITTER_NAME: "EngFlow GitHub Automation"
GIT_COMMITTER_EMAIL: "engflow-github-automation@engflow.com"
run: |
VERSION="$(date -u '+%Y.%m.%d-%H.%M.%S')"
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
# 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" \
"//go/MODULE.bazel:engflowapis-go" \
"//go/MODULE.bazel:engflowapis" \
"//java/MODULE.bazel:engflowapis-java" \
"//java/MODULE.bazel:engflowapis"
git add \
"MODULE.bazel" \
"go/MODULE.bazel" \
"java/MODULE.bazel"
git commit -m "Release ${VERSION}"
# 3. Push release tag.
git tag "${VERSION}" "HEAD"
git push origin "${VERSION}"
# 4. Create release tarball
git archive -o "${RUNNER_TEMP}/archive.tar.gz" "${VERSION}"
- name: Create GitHub Release
id: "create-release"
uses: "actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e" # v1
with:
tag_name: ${{ steps.tag.outputs.version }}
release_name: Release ${{ steps.tag.outputs.version }}
body: |
# EngFlow APIs ${{ steps.tag.outputs.version }}
To use this module, please add the following to `MODULE.bazel`:
```starlark
bazel_dep(name = "engflowapis", version = "${{ steps.tag.outputs.version }}")
```
## Go
```starlark
bazel_dep(name = "engflowapis-go", version = "${{ steps.tag.outputs.version }}")
```
## Java
```starlark
bazel_dep(name = "engflowapis-java", version = "${{ steps.tag.outputs.version }}")
```
prerelease: false
- name: Upload Tarball
id: upload-release-asset
uses: "actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5" # v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ runner.temp }}/archive.tar.gz
asset_name: engflowapis-${{ steps.tag.outputs.version }}.tar.gz
asset_content_type: "application/gzip"
outputs:
version: "${{ steps.tag.outputs.version }}"
upload_to_bcr:
needs:
- "publish"
if: github.ref == 'refs/heads/main'
uses: "./.github/workflows/publish-to-bcr.yaml"
with:
tag_name: "${{ needs.publish.outputs.version }}"
secrets: "inherit"