Publish Release #321
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.22.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@866beb009af3db457e82ca98efe474969a5ebce8 | |
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.22.x | |
check-latest: true | |
cache: true | |
- name: Auth To GCP | |
uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c | |
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@98ddc00a17442e89a24bbf282954a3b65ce6d200 | |
- name: Upload To Release Bucket | |
run: gsutil -m rsync -c -r modules/sync gs://buf-modules | |
- uses: dblock/create-a-github-issue@866beb009af3db457e82ca98efe474969a5ebce8 | |
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 |