Publish Release #516
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: Publish Release | |
on: | |
schedule: | |
# Fetch PRs are fired every weekday at morning. Do releases in the afternoon. | |
# At 15:00 EST (20:00 UTC) on every day-of-week from Monday through Friday. https://crontab.guru/#0_20_*_*_1-5 | |
- cron: "0 20 * * 1-5" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
id-token: write | |
issues: write | |
packages: read | |
jobs: | |
release: | |
if: github.repository == 'bufbuild/modules' | |
runs-on: ubuntu-latest | |
outputs: | |
did_release: ${{ steps.release.outputs.did_release }} | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.x | |
check-latest: true | |
cache: true | |
- name: Create Release | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: go run ./cmd/release . | |
- uses: dblock/create-a-github-issue@c5e54b8762a0c4c2cd9330750e30b81bcc369c38 | |
if: failure() | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
GITHUB_SERVER_URL: ${ github.server_url }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }} | |
with: | |
filename: .github/automatic-workflow-issue-template.md | |
update_existing: true | |
search_existing: open | |
# sync job is currently syncing the whole sync directory, it runs | |
# every time, regardless if there was a release or not, or even if the | |
# release job failed. TODO: We can improve efficiency here by doing | |
# two things: (1) only triggering sync job when there's a release | |
# produced from the previous step, and (2) only syncing directories | |
# (or even files) that changed in the rsync invocation. | |
sync: | |
needs: release | |
environment: production | |
if: github.repository == 'bufbuild/modules' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.x | |
check-latest: true | |
cache: true | |
- name: Auth To GCP | |
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f | |
with: | |
workload_identity_provider: projects/252484117105/locations/global/workloadIdentityPools/modules-workload-pool/providers/modules-workload-provider | |
service_account: buf-modules-1-bufbuild-modules@buf-modules-1.iam.gserviceaccount.com | |
- name: Setup gcloud | |
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a | |
- name: Upload To Release Bucket | |
run: gsutil -m rsync -c -r modules/sync gs://buf-modules | |
- uses: dblock/create-a-github-issue@c5e54b8762a0c4c2cd9330750e30b81bcc369c38 | |
if: failure() | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
GITHUB_SERVER_URL: ${ github.server_url }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }} | |
with: | |
filename: .github/automatic-workflow-issue-template.md | |
update_existing: true | |
search_existing: open |