blob: 970e72382b76570099105755bf4f9c8d7ef57aa5 [file]
name: Create Release
on:
workflow_dispatch:
inputs:
tag:
description: 'The new version to tag, ex: 1.0.5'
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create Release
run: |
set -euo pipefail
git archive --format=tar.gz --output "apple_support.$TAG.tar.gz" HEAD
./.github/generate-notes.sh "$TAG" | tee notes.md
# Add generated API docs to the release
# See https://github.com/bazelbuild/bazel-central-registry/blob/main/docs/stardoc.md
docs="$(mktemp -d)"; targets="$(mktemp)"
bazel --output_base="$docs" query --output=label --output_file="$targets" 'kind("starlark_doc_extract rule", //...)'
bazel --output_base="$docs" build --target_pattern_file="$targets"
tar --create --auto-compress \
--directory "$(bazel --output_base="$docs" info bazel-bin)" \
--file "apple_support.$TAG.docs.tar.gz" .
gh release create "$TAG" --title "$TAG" --target "$GITHUB_REF_NAME" --notes-file notes.md "apple_support.$TAG.tar.gz" "apple_support.$TAG.docs.tar.gz"
env:
TAG: ${{ inputs.tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: create-release
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.0.0
with:
tag_name: ${{ inputs.tag }}
registry_fork: bazelbuild/bazel-central-registry
# TODO: Enable attestations once supported
# https://github.com/bazel-contrib/publish-to-bcr/issues/342
attest: false
secrets:
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}
permissions:
attestations: write
contents: write
id-token: write