Create release #715
This file contains 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
name: Create release | |
on: | |
schedule: | |
- cron: "0 5 * * *" # Once a day at 5am. | |
# Manual runs through Actions tab in the UI | |
workflow_dispatch: | |
permissions: | |
actions: read | |
contents: write | |
id-token: write | |
pull-requests: read | |
# Cancel previous runs if a new one is started. | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
create_release: | |
runs-on: ubuntu-22.04 | |
steps: | |
# Check out repo at latest green postsubmit commit on the main branch. | |
- name: Get latest passing commit | |
id: latest-green | |
env: | |
REPO: ${{ github.repository }} | |
run: | | |
set -euo pipefail | |
output=$(curl --fail-with-body -sS \ | |
-H "Accept: application/vnd.github+json" \ | |
"https://api.github.com/repos/$REPO/actions/workflows/postsubmit.yml/runs?per_page=1&branch=main&event=schedule&status=success") | |
repo_id=$(jq -r '.workflow_runs[0].head_repository.id' <<< $output) | |
if [[ "${repo_id}" != "${{ github.repository_id }}" ]] ; then | |
echo >&2 "Unexpected head repository ID: ${repo_id} - check postsubmit.yml configuration" | |
exit 1 | |
fi | |
sha=$(jq -r '.workflow_runs[0].head_sha' <<< $output) | |
echo "latest_green=$sha" >> $GITHUB_OUTPUT | |
- name: Checkout repository | |
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # tag=v3.2.0 | |
with: | |
ref: ${{ steps.latest-green.outputs.latest_green }} | |
- name: Auth | |
uses: google-github-actions/auth@5a50e581162a13f4baa8916d01180d2acbc04363 # tag=v2.1.0 | |
with: | |
create_credentials_file: true # also sets GOOGLE_APPLICATION_CREDENTIALS | |
service_account: "[email protected]" | |
workload_identity_provider: "projects/695270090783/locations/global/workloadIdentityPools/github-automation/providers/crc-prod" | |
- name: "Set up gcloud" | |
uses: "google-github-actions/setup-gcloud@98ddc00a17442e89a24bbf282954a3b65ce6d200" # tag=v2.1.0 | |
with: | |
skip_install: true | |
- name: Deploy Navtest on Cloud Build | |
run: | | |
gcloud builds submit \ | |
--project robco-navtest \ | |
--config .github/ci/deploy_navtest_cloudbuild.yaml | |
# Now we are ready to create the release. | |
- name: Run release_binary.sh | |
env: | |
REPO: ${{ github.repository }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FULL_SHA: ${{ steps.latest-green.outputs.latest_green }} | |
run: ./.github/ci/release_binary.sh |