| name: "Create a submodule release" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| subdir: | |
| required: true | |
| type: string | |
| description: "The subdir within rules_pkg" | |
| default: "providers" | |
| version: | |
| required: true | |
| type: string | |
| description: "Version #" | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| contents: write | |
| jobs: | |
| tests: | |
| name: "Release Tests" | |
| uses: "./.github/workflows/checks.yml" | |
| create_tag: | |
| name: "Create tag" | |
| runs-on: | |
| - "ubuntu-latest" | |
| needs: | |
| - "tests" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Create tag" | |
| id: "tag" | |
| env: | |
| SUBDIR: "${{ inputs.subdir }}" | |
| VERSION: "${{ inputs.version }}" | |
| MODULE: "rules_pkg_${{ inputs.subdir }}" | |
| 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: | | |
| # Download `buildozer` | |
| # | |
| curl -o "${RUNNER_TEMP}/buildozer" -L "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-linux-amd64" | |
| chmod a+x "${RUNNER_TEMP}/buildozer" | |
| "${RUNNER_TEMP}/buildozer" "set version ${VERSION}" "//${SUBDIR}/MODULE.bazel:${MODULE}" || true | |
| git add "${SUBDIR}/MODULE.bazel" | |
| sed -i -e "s/@AUTO_VERSION@/${VERSION}/" ${SUBDIR}/version.bzl | |
| git add "${SUBDIR}/version.bzl" | |
| git commit -m "Release `${MODULE}-${VERSION}`" | |
| # 3. Push release tag. | |
| git tag "${MODULE}-${VERSION}" "HEAD" | |
| git push origin "${MODULE}-${VERSION}" | |
| release: | |
| name: "Create GitHub release" | |
| needs: | |
| - "create_tag" | |
| uses: "bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.2.4" | |
| with: | |
| # This will run release_prep.sh to do the dirty work. | |
| # TODO: https://github.com/bazelbuild/rules_pkg/issues/1031 | |
| release_files: "bazel-bin/distro/rules_pkg_${{ inputs.subdir }}-*.tgz" | |
| tag_name: "rules_pkg_${{ inputs.subdir }}-${{ inputs.version }}" | |
| # We only do a partial test. The problem is that RPM does not work on the github runners | |
| # so we must skip, but the release_ruleset flow appends cache flags to the command. That | |
| # makes the syntax 'bazel test //... -- -//test/rpm/... =disk_cache-flag' impossible. | |
| # It doesn't matter. We have to do the full test anyway before hitting this, so everything | |
| # should still work, if we only changed the version in the module. | |
| bazel_test_command: "bazel test --build_tests_only //tests/tar/... //tests/zip/..." |