blob: bf1c4a445d722ebd4628aacb31046b61762a34ca [file] [log] [blame]
---
steps:
- label: "Release rules_platform"
agents:
- "queue=default"
plugins:
docker#v3.8.0:
always-pull: true
environment:
- ANDROID_HOME
- ANDROID_NDK_HOME
- BUILDKITE_ARTIFACT_UPLOAD_DESTINATION
image: gcr.io/bazel-public/ubuntu2004-java11
network: host
privileged: true
propagate-environment: true
propagate-uid-gid: true
shell: ["/bin/bash", "-e", "-c"]
volumes:
- "/etc/group:/etc/group:ro"
- "/etc/passwd:/etc/passwd:ro"
- "/etc/shadow:/etc/shadow:ro"
- "/opt/android-ndk-r15c:/opt/android-ndk-r15c:ro"
- "/opt/android-sdk-linux:/opt/android-sdk-linux:ro"
- "/var/lib/buildkite-agent:/var/lib/buildkite-agent"
- "/var/lib/gitmirrors:/var/lib/gitmirrors:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
command: |
echo "+++ Checking out Git branch"
git fetch origin ${BUILDKITE_BRANCH}
git checkout ${BUILDKITE_BRANCH}
echo "+++ Getting the latest rules_platform version"
contents=$(cat MODULE.bazel)
version=$(echo "\${contents}" | grep -m 1 "version")
version=$(echo "\${version}" | sed -E 's/[^0-9|\.]//g')
echo "version = \"\$version\""
echo "+++ Building the release"
bazel build //distro:rules_platform-\${version}
echo "+++ Preparing release notes"
bazel build //distro:relnotes
echo "+++ Downloading github-release"
curl -L https://mirror.bazel.build/github.com/c4milo/github-release/releases/download/v1.1.0/github-release_v1.1.0_linux_amd64.tar.gz | sudo tar xz -C /usr/local/bin
sudo chown root:root /usr/local/bin/github-release
sudo chmod 0755 /usr/local/bin/github-release
echo "+++ Importing GitHub token"
github_token=$(gsutil cat gs://bazel-trusted-encrypted-secrets/github-trusted-token.enc | gcloud kms decrypt --project bazel-public --location global --keyring buildkite --key github-trusted-token --ciphertext-file - --plaintext-file -)
echo "+++ Creating a release on GitHub"
cd bazel-bin/distro
relnotes=$(cat relnotes.txt)
GITHUB_TOKEN=\${github_token} github-release "bazelbuild/rules_platform" \${version} "\${BUILDKITE_BRANCH}" "\${relnotes}" rules_platform-\${version}.tar.gz