Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/bazel.ci.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
name: Buildifier

# Controls when the action will run.
"on":
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
Expand All @@ -24,10 +23,6 @@ name: Buildifier

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
# Cancel previous actions from the same PR or branch except 'main' branch.
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}}
cancel-in-progress: ${{ github.ref_name != 'main' }}

jobs:
test:
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@29e53247c6366e30acbedfc767f58f79fc05836c
with:
folders: |
[
".",
]
exclude_windows: true
exclude: |
[
{"bazelversion": "5.4.0", "bzlmodEnabled": true},
{"bazelversion": "5.4.0", "bzlmodEnabled": false},
{"bazelversion": "5.4.0", "os": "macos-latest"},
]
32 changes: 0 additions & 32 deletions .github/workflows/on.release.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Publish new releases to Bazel Central Registry.
name: Publish to BCR
on:
# Run the publish workflow after a successful release
# Will be triggered from the release.yaml workflow
workflow_call:
inputs:
tag_name:
required: true
type: string
secrets:
publish_token:
required: true
# In case of problems, let release engineers retry by manually dispatching
# the workflow from the GitHub UI
workflow_dispatch:
inputs:
tag_name:
description: git tag being released
required: true
type: string
jobs:
publish:
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
with:
tag_name: ${{ inputs.tag_name }}
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
registry_fork: sgammon/bazel-central-registry
permissions:
attestations: write
contents: write
id-token: write
secrets:
# Necessary to push to the BCR fork, and to open a pull request against a registry
publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Cut a release whenever a new tag is pushed to the repo.
name: Release
on:
# Can be triggered from the tag.yaml workflow
workflow_call:
inputs:
tag_name:
required: true
type: string
secrets:
publish_token:
required: true
# Or, developers can manually push a tag from their clone
push:
tags:
- "v*.*.*"
permissions:
id-token: write
attestations: write
contents: write
jobs:
release:
uses: bazel-contrib/.github/.github/workflows/[email protected]
with:
release_files: rules_graalvm-*.tar.gz
prerelease: false
tag_name: ${{ github.ref_name }}
publish:
needs: release
uses: ./.github/workflows/publish.yaml
with:
tag_name: ${{ github.ref_name }}
secrets:
publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }}
18 changes: 11 additions & 7 deletions .github/workflows/release_prep.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

set -o errexit -o nounset -o pipefail

# Set by GH actions, see
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
TAG=${GITHUB_REF_NAME}
# Argument provided by reusable workflow caller, see
# https://github.com/bazel-contrib/.github/blob/d197a6427c5435ac22e56e33340dff912bc9334e/.github/workflows/release_ruleset.yaml#L72
TAG=$1
# The prefix is chosen to match what GitHub generates for source archives
# This guarantees that users can easily switch from a released artifact to a source archive
# with minimal differences in their code (e.g. strip_prefix remains the same)
PREFIX="rules_graalvm-${TAG:1}"
ARCHIVE="rules_graalvm-$TAG.tgz"
ARCHIVE="rules_graalvm-$TAG.tar.gz"

# NB: configuration for 'git archive' is in /.gitattributes
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

Expand All @@ -16,9 +20,9 @@ cat << EOF

See the project repository for documentation.

## Using Bzlmod with Bazel 6+
## Using Bzlmod with Bazel 6 or greater

1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
1. (Bazel 6 only) Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
2. Add to your \`MODULE.bazel\` file:

\`\`\`starlark
Expand All @@ -40,4 +44,4 @@ http_archive(
EOF

awk 'f;/--SNIP--/{f=1}' example/integration_tests/bzlmod/WORKSPACE.bazel
echo "\`\`\`"
echo "\`\`\`"
44 changes: 44 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Tag a new release using https://github.com/marketplace/actions/conventional-commits-versioner-action
#
# This is easier than having to run manual `git` operations on a local clone.
# It also runs on a schedule so we don't leave commits unreleased indefinitely
# (avoiding users having to ping "hey could someone cut a release").

name: Tag a Release
on:
# Allow devs to tag manually through the GitHub UI.
# For example after landing a fix that customers are waiting for.
workflow_dispatch:
# Run twice a month, on the 1rst and 15th at 3PM UTC (8AM PST)
# This is a trade-off between making too many releases,
# which overwhelms BCR maintainers and over-notifies users,
# and releasing too infrequently which delays delivery of bugfixes and features.
schedule:
- cron: "0 15 1,15 * *"
jobs:
tag:
permissions:
contents: write # allow create tag
runs-on: ubuntu-latest
outputs:
new-tag: ${{ steps.ccv.outputs.new-tag }}
new-tag-version: ${{steps.ccv.outputs.new-tag-version}}
new-tag-version-type: ${{steps.ccv.outputs.new-tag-version-type}}
steps:
- uses: actions/checkout@v4
with:
# Need enough history to find the prior release tag
fetch-depth: 0
- name: Bump tag if necessary
id: ccv
uses: smlx/ccv@7318e2f25a52dcd550e75384b84983973251a1f8 # v0.10.0
release:
needs: tag
uses: ./.github/workflows/release.yml
with:
tag_name: ${{ needs.tag.outputs.new-tag-version }}
secrets:
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}
if: needs.tag.outputs.new-tag == 'true' && needs.tag.outputs.new-tag-version-type != 'major'
permissions:
contents: write # allow create release
Loading