Skip to content

Commit 5407dd5

Browse files
authored
chore: update BCR publishing to use workflow (#177)
The GH App is legacy and being deprecated.
1 parent 4b88621 commit 5407dd5

File tree

10 files changed

+123
-29
lines changed

10 files changed

+123
-29
lines changed

.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build --java_runtime_version=remotejdk_11
1818

1919
# Newer versions jdk creates collisions on /tmp
2020
# See: https://github.com/bazelbuild/bazel/issues/3236
21-
# https://github.com/GoogleContainerTools/rules_distroless/actions/runs/7118944984/job/19382981899?pr=9#step:8:51
21+
# https://github.com/bazel-contrib/rules_distroless/actions/runs/7118944984/job/19382981899?pr=9#step:8:51
2222
common:linux --sandbox_tmpfs_path=/tmp
2323

2424

.bcr/config.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.bcr/metadata.template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"homepage": "https://github.com/GoogleContainerTools/rules_distroless",
2+
"homepage": "https://github.com/bazel-contrib/rules_distroless",
33
"maintainers": [
44
{
55
"email": "[email protected]",
@@ -12,7 +12,7 @@
1212
"name": "Şahin Yort"
1313
}
1414
],
15-
"repository": ["github:GoogleContainerTools/rules_distroless"],
15+
"repository": ["github:bazel-contrib/rules_distroless"],
1616
"versions": [],
1717
"yanked_versions": {}
1818
}

.github/workflows/publish.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Publish new releases to Bazel Central Registry.
2+
name: Publish to BCR
3+
on:
4+
# Run the publish workflow after a successful release
5+
# Will be triggered from the release.yaml workflow
6+
workflow_call:
7+
inputs:
8+
tag_name:
9+
required: true
10+
type: string
11+
secrets:
12+
BCR_PUBLISH_TOKEN:
13+
required: true
14+
# In case of problems, let release engineers retry by manually dispatching
15+
# the workflow from the GitHub UI
16+
workflow_dispatch:
17+
inputs:
18+
tag_name:
19+
description: git tag being released
20+
required: true
21+
type: string
22+
jobs:
23+
publish:
24+
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
25+
with:
26+
tag_name: ${{ inputs.tag_name }}
27+
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
28+
registry_fork: bazel-contrib/bazel-central-registry
29+
draft: false
30+
permissions:
31+
attestations: write
32+
contents: write
33+
id-token: write
34+
secrets:
35+
# Necessary to push to the BCR fork, and to open a pull request against a registry
36+
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}

.github/workflows/release.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Cut a release whenever a new tag is pushed to the repo.
2+
name: Release
3+
on:
4+
# Can be triggered from the tag.yaml workflow
5+
workflow_call:
6+
inputs:
7+
tag_name:
8+
required: true
9+
type: string
10+
secrets:
11+
BCR_PUBLISH_TOKEN:
12+
required: true
13+
# Or, developers can manually push a tag from their clone
14+
push:
15+
tags:
16+
- "v*.*.*"
17+
permissions:
18+
id-token: write
19+
attestations: write
20+
contents: write
21+
jobs:
22+
release:
23+
uses: bazel-contrib/.github/.github/workflows/[email protected]
24+
with:
25+
release_files: rules_distroless-*.tar.gz
26+
prerelease: false
27+
tag_name: ${{ inputs.tag_name || github.ref_name }}
28+
publish:
29+
needs: release
30+
uses: ./.github/workflows/publish.yaml
31+
with:
32+
tag_name: ${{ inputs.tag_name || github.ref_name }}
33+
secrets:
34+
BCR_PUBLISH_TOKEN: ${{ secrets.BCR_PUBLISH_TOKEN }}

.github/workflows/release.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/tag.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Tag a new release using https://github.com/marketplace/actions/conventional-commits-versioner-action
2+
#
3+
# This is easier than having to run manual `git` operations on a local clone.
4+
# It also runs on a schedule so we don't leave commits unreleased indefinitely
5+
# (avoiding users having to ping "hey could someone cut a release").
6+
7+
name: Tag a Release
8+
on:
9+
# Allow devs to tag manually through the GitHub UI.
10+
# For example after landing a fix that customers are waiting for.
11+
workflow_dispatch:
12+
# Run twice a month, on the 2nd and 16th at 3PM UTC (8AM PST)
13+
# This is a trade-off between making too many releases,
14+
# which overwhelms BCR maintainers and over-notifies users,
15+
# and releasing too infrequently which delays delivery of bugfixes and features.
16+
schedule:
17+
- cron: "0 15 2,16 * *"
18+
jobs:
19+
tag:
20+
permissions:
21+
contents: write # allow create tag
22+
runs-on: ubuntu-latest
23+
outputs:
24+
new-tag: ${{ steps.ccv.outputs.new-tag }}
25+
new-tag-version: ${{steps.ccv.outputs.new-tag-version}}
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
# Need enough history to find the prior release tag
30+
fetch-depth: 0
31+
- name: Bump tag if necessary
32+
id: ccv
33+
uses: smlx/ccv@7318e2f25a52dcd550e75384b84983973251a1f8 # v0.10.0
34+
release:
35+
needs: tag
36+
uses: ./.github/workflows/release.yaml
37+
with:
38+
tag_name: ${{ needs.tag.outputs.new-tag-version }}
39+
secrets:
40+
BCR_PUBLISH_TOKEN: ${{ secrets.BCR_PUBLISH_TOKEN }}
41+
if: needs.tag.outputs.new-tag == 'true' && needs.tag.outputs.new-tag-version-type != 'major'
42+
permissions:
43+
id-token: write
44+
attestations: write
45+
contents: write

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ bazel_dep(name = "rules_distroless", version = "0.5.1")
5454

5555
git_override(
5656
module_name = "rules_distroless",
57-
remote = "https://github.com/GoogleContainerTools/rules_distroless.git",
57+
remote = "https://github.com/bazel-contrib/rules_distroless.git",
5858
commit = "a69bc1949d5daf2d1b0906890667d69b0897688b",
5959
)
6060
```
@@ -117,7 +117,7 @@ check the following docs:
117117
[`archive_override`]: https://bazel.build/versions/6.0.0/rules/lib/globals#archive_override
118118
[`local_path_override`]: https://bazel.build/versions/6.0.0/rules/lib/globals#local_path_override
119119
[Bzlmod migration guide]: https://bazel.build/external/migration
120-
[`rules_distroless` Github releases page]: https://github.com/GoogleContainerTools/rules_distroless/releases
120+
[`rules_distroless` Github releases page]: https://github.com/bazel-contrib/rules_distroless/releases
121121
[Update on the future stability of source code archives and hashes]: https://github.blog/2023-02-21-update-on-the-future-stability-of-source-code-archives-and-hashes
122-
[Google's `distroless` container images]: https://github.com/GoogleContainerTools/distroless
122+
[Google's `distroless` container images]: https://github.com/bazel-contrib/distroless
123123
[Arize AI]: https://www.arize.com

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Reporting a Vulnerability
44

5-
If it is not security critical, please open an [issue](https://github.com/GoogleContainerTools/rules_distroless/issues)
5+
If it is not security critical, please open an [issue](https://github.com/bazel-contrib/rules_distroless/issues)
66

77
If it could be potentially exploited, or you are unsure if it can,
88
please report privately via github [(instructions)](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability)

apt/private/apt_dep_resolver.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _resolve_package(state, name, version, arch):
5858

5959
# Since versions are ordered by hight to low, the first satisfied version will be
6060
# the highest version and rules_distroless ignores Priority field so it's safe.
61-
# TODO: rethink this `break` with https://github.com/GoogleContainerTools/rules_distroless/issues/34
61+
# TODO: rethink this `break` with https://github.com/bazel-contrib/rules_distroless/issues/34
6262
break
6363
elif len(versions) > 0:
6464
# First element in the versions list is the latest version.

0 commit comments

Comments
 (0)