-
-
Notifications
You must be signed in to change notification settings - Fork 5
Feature/tools versioning #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ankushkumar11
wants to merge
6
commits into
bazel-contrib:main
Choose a base branch
from
ankushkumar11:feature/tools_versioning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
be9cc48
Created metadata.template.json
ankushkumar11 b8dc0be
Create presubmit.yml
ankushkumar11 8c6c20c
Create source.template.json
ankushkumar11 0dbfe30
Create tools_release_prep.sh
ankushkumar11 e3fbb64
Create tools_release.yml
ankushkumar11 a176a79
Added Tony as maintainer in metadata.template.json
ankushkumar11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "homepage": "https://github.com/bazel-contrib/supply-chain", | ||
| "maintainers": [ | ||
| { | ||
| "email": "[email protected]", | ||
| "github": "aiuto", | ||
| "name": "Tony Aiuto" | ||
| }, | ||
| { | ||
| "email": "[email protected]", | ||
| "github": "TheGrizzlyDev", | ||
| "name": "Antonio Di Stefano" | ||
| }, | ||
| { | ||
| "email": "[email protected]", | ||
| "github": "fweikert", | ||
| "name": "Florian Weikert" | ||
| }, | ||
| { | ||
| "email": "[email protected]", | ||
| "github": "Yannic", | ||
| "name": "Yannic Bonenberger" | ||
| } | ||
| ], | ||
| "repository": ["github:bazel-contrib/supply-chain"], | ||
| "versions": [], | ||
| "yanked_versions": {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| matrix: | ||
| platform: | ||
| - debian10 | ||
| - ubuntu2004 | ||
| - macos | ||
| - windows | ||
| bazel | ||
| - 8.x | ||
| - 7.x | ||
| - 6.x | ||
| tasks: | ||
| verify_targets: | ||
| name: Verify build targets | ||
| platform: ${{ platform }} | ||
| bazel: ${{ bazel }} | ||
| build_targets: | ||
| - '@supply_chain_tools//...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "integrity": "**leave this alone**", | ||
| "strip_prefix": "{REPO}-{VERSION}/tools", | ||
| "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| name: "Create supply_chain_tools release" | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| required: true | ||
| type: "string" | ||
| description: "Version for supply_chain_tools release (e.g., 1.0.0)" | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| attestations: write | ||
| contents: write | ||
|
|
||
| jobs: | ||
| ci: | ||
| name: "CI" | ||
| uses: "./.github/workflows/ci.yml" | ||
|
|
||
| create_tools_tag: | ||
| name: "Create supply_chain_tools tag" | ||
| runs-on: | ||
| - "ubuntu-latest" | ||
| needs: | ||
| - "ci" | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: "Create supply_chain_tools tag" | ||
| id: "tag" | ||
| env: | ||
| VERSION: "${{ inputs.version }}" | ||
| GIT_AUTHOR_NAME: "${{ github.actor }}" | ||
| GIT_AUTHOR_EMAIL: "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | ||
| GIT_COMMITTER_NAME: "${{ github.actor }}" | ||
| GIT_COMMITTER_EMAIL: "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | ||
| run: | | ||
| # 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 supply_chain_tools MODULE.bazel version | ||
| "${RUNNER_TEMP}/buildozer" "set version ${VERSION}" "//tools/MODULE.bazel:supply_chain_tools" | ||
| git add "tools/MODULE.bazel" | ||
| git commit -m "Release supply_chain_tools v${VERSION}" | ||
|
|
||
| # 3. Push supply_chain_tools release tag | ||
| git tag "supply_chain_tools-v${VERSION}" "HEAD" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| git push origin "supply_chain_tools-v${VERSION}" | ||
|
|
||
| - name: "Generate release artifacts" | ||
| run: | | ||
| ./.github/workflows/tools_release_prep.sh "supply_chain_tools-v${{ inputs.version }}" > release_notes.md | ||
|
|
||
| - name: "Upload release artifacts" | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: supply_chain_tools-release-artifacts | ||
| path: | | ||
| supply-chain-tools-*.tar.gz | ||
| release_notes.md | ||
|
|
||
| release: | ||
| name: "Create GitHub release for supply_chain_tools" | ||
| needs: | ||
| - "create_tools_tag" | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: "Download artifacts" | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: supply_chain_tools-release-artifacts | ||
|
|
||
| - name: "Create GitHub Release" | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: "supply_chain_tools-v${{ inputs.version }}" | ||
| name: "supply_chain_tools v${{ inputs.version }}" | ||
| body_path: release_notes.md | ||
| files: | | ||
| supply-chain-tools-*.tar.gz | ||
| draft: false | ||
| prerelease: false | ||
|
|
||
| publish_to_bcr: | ||
| name: "Publish supply_chain_tools to BCR" | ||
| needs: | ||
| - "release" | ||
|
|
||
| permissions: | ||
| attestations: write | ||
| contents: write | ||
| id-token: write | ||
|
|
||
| uses: "bazel-contrib/publish-to-bcr/.github/workflows/[email protected]" | ||
| with: | ||
| tag_name: "supply_chain_tools-v${{ inputs.version }}" | ||
| registry_fork: "bazel-contrib/bazel-central-registry" | ||
| draft: false | ||
| secrets: | ||
| publish_token: "${{ secrets.BCR_PUBLISH_TOKEN }}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -o errexit -o nounset -o pipefail | ||
|
|
||
| # Passed as argument when invoking the script. | ||
| 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="supply-chain-tools-${TAG:1}" | ||
| ARCHIVE="supply-chain-tools-$TAG.tar.gz" | ||
|
|
||
| # Create a temporary directory for the tools content | ||
| TEMP_DIR=$(mktemp -d) | ||
| trap "rm -rf $TEMP_DIR" EXIT | ||
|
|
||
| # Copy the tools directory to the temporary location with the correct prefix | ||
| mkdir -p "$TEMP_DIR/$PREFIX" | ||
| cp -r tools/* "$TEMP_DIR/$PREFIX/" | ||
|
|
||
| # Create the archive from the temporary directory | ||
| cd "$TEMP_DIR" | ||
| tar -czf "$OLDPWD/$ARCHIVE" "$PREFIX" | ||
| cd "$OLDPWD" | ||
|
|
||
| SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') | ||
|
|
||
| cat << EOF | ||
| ## Using Bzlmod with Bazel 6 or greater | ||
|
|
||
| 1. (Bazel 6 only) Enable with \`common --enable_bzlmod\` in \`.bazelrc\`. | ||
| 2. Add to your \`MODULE.bazel\` file: | ||
|
|
||
| \`\`\`starlark | ||
| bazel_dep(name = "supply_chain_tools", version = "${TAG:1}") | ||
| \`\`\` | ||
|
|
||
| ## Using WORKSPACE | ||
|
|
||
| Paste this snippet into your \`WORKSPACE.bazel\` file: | ||
|
|
||
| \`\`\`starlark | ||
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
| http_archive( | ||
| name = "supply_chain_tools", | ||
| sha256 = "${SHA}", | ||
| strip_prefix = "${PREFIX}", | ||
| url = "https://github.com/bazel-contrib/supply-chain/releases/download/${TAG}/${ARCHIVE}", | ||
| ) | ||
| \`\`\` | ||
| EOF |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buildozer is overkill. We should be able to rewrite the version with sed.