From 051cba041ce7ea311c79fd9107b0abe8e9ed90f6 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Thu, 20 Aug 2026 18:48:19 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9=E3=82=92?= =?UTF-8?q?=20docs=20=E3=83=90=E3=82=B1=E3=83=83=E3=83=88=E3=81=AE=20wasm/?= =?UTF-8?q?=20prefix=20=E3=81=B8=E5=90=8C=E6=9C=9F=E3=81=99=E3=82=8B=20wor?= =?UTF-8?q?kflow=20=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit リリース公開時(と手動 dispatch)に、アセットを s3://docs.r-l.o/wasm/<タグ>/ へアップロードする。RUN ボタンは docs.ruby-lang.org/wasm/<タグ>/ruby-<版>.wasm を読む(同一オリジン)。 認証は OIDC(docs-sync-run-ruby-wasm ロール・wasm/* prefix 限定)。 .wasm の Content-Type は streaming compile に必須のため明示する。 初回リリース 2.9.3-2.9.4-1 のアセットは手動アップロード済みのため、 この workflow は次のリリースから使われる。 Co-Authored-By: Claude Fable 5 --- .github/workflows/sync_docs_bucket.yml | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/sync_docs_bucket.yml diff --git a/.github/workflows/sync_docs_bucket.yml b/.github/workflows/sync_docs_bucket.yml new file mode 100644 index 0000000..c230383 --- /dev/null +++ b/.github/workflows/sync_docs_bucket.yml @@ -0,0 +1,50 @@ +# リリースされた ruby.wasm(bundled gems 同梱ビルド)のアセットを +# docs.ruby-lang.org の S3 バケットへ同期する。RUN ボタンは +# https://docs.ruby-lang.org/wasm/<タグ>/ruby-<版>.wasm を読み込む +# (Fastly の VCL が Surrogate-Key: wasm を付けて配信する)。 +# +# 認証は OIDC(ruby/ruby-infra-recipe cdn/iam.tf の +# docs-sync-run-ruby-wasm ロール。wasm/* prefix 限定で、main と +# リリースタグの ref から assume できる)。リポジトリ変数 +# DOCS_SYNC_ROLE_ARN が未設定の間は何もしない。 +name: sync docs bucket + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: "同期するリリースタグ(例: 2.9.3-2.9.4-1)" + required: true + +permissions: + id-token: write + contents: read + +jobs: + sync: + runs-on: ubuntu-latest + if: ${{ vars.DOCS_SYNC_ROLE_ARN != '' }} + env: + TAG: ${{ github.event.release.tag_name || inputs.tag }} + steps: + - name: Download release assets + env: + GH_TOKEN: ${{ github.token }} + run: gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --dir assets + + - uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ vars.DOCS_SYNC_ROLE_ARN }} + aws-region: us-east-1 + + # Content-Type は明示する(.wasm は自動判定されず、ブラウザの + # streaming compile には application/wasm が必須)。リリースの + # アセットは不変なので --delete は使わない(過去タグの配下も残す) + - name: Upload to s3://docs.r-l.o/wasm// + run: | + aws s3 cp assets "s3://docs.r-l.o/wasm/${TAG}/" --recursive \ + --exclude "*" --include "*.wasm" --content-type application/wasm --no-progress + aws s3 cp assets "s3://docs.r-l.o/wasm/${TAG}/" --recursive \ + --exclude "*" --include "*.json" --content-type application/json --no-progress