Skip to content

Commit e68e3c8

Browse files
razor-xseambot
andauthored
Publish assets to R2 (#338)
* Add tmp check for R2 publish * Publish to R2 * Use WNAM for location * Test assets with ls * ci: Format code * Move ls test * Do not extract package * Fix var refs * Fix var refs * Extract tgz * Remove assets check --------- Co-authored-by: Seam Bot <[email protected]>
1 parent a7b71a3 commit e68e3c8

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

.github/workflows/check.yml

+23
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,26 @@ jobs:
135135
uses: ./.github/actions/setup
136136
- name: Build docs
137137
run: npm run docs:build
138+
assets:
139+
name: Assets
140+
runs-on: ubuntu-latest
141+
timeout-minutes: 30
142+
needs: build
143+
steps:
144+
- name: Download artifact
145+
uses: actions/download-artifact@v3
146+
with:
147+
name: ${{ needs.build.outputs.artifact_name }}
148+
path: .
149+
- name: Extract package
150+
run: tar -xzf *.tgz
151+
- name: Sync R2
152+
uses: jakejarvis/[email protected]
153+
env:
154+
AWS_S3_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET_NAME }}
155+
AWS_ACCESS_KEY_ID: ${{ vars.CLOUDFLARE_R2_ACCESS_KEY_ID }}
156+
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
157+
AWS_REGION: ${{ vars.CLOUDFLARE_R2_BUCKET_REGION }}
158+
AWS_S3_ENDPOINT: https://${{ vars.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
159+
SOURCE_DIR: package
160+
DEST_DIR: tmp/${{ github.sha }}

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,24 @@ The following repository secrets must be set on [GitHub Actions]:
424424

425425
The following repository variables must be set on [GitHub Actions]:
426426

427-
- `CLOUDFLARE_R2_BUCKET`: The Cloudflare R2 bucket name.
428427
- `VERCEL_TEAM_ID`: The Vercel team id.
429428
- `STORYBOOK_SEAM_ENDPOINT`: The Seam endpoint to use with Storybook.
430429
- `STORYBOOK_SEAM_PUBLISHABLE_KEY`: The Seam publishable key to use with Storybook.
431430
- `STORYBOOK_SEAM_USER_IDENTIFIER_KEY`: The Seam user identifer key to use with Storybook.
432431

432+
### R2 Bucket
433+
434+
The following repository variables must be set on GitHub Actions:
435+
436+
- `CLOUDFLARE_ACCOUNT_ID`: The Cloudflare account id.
437+
- `CLOUDFLARE_R2_BUCKET_NAME`: The Cloudflare R2 bucket name.
438+
- `CLOUDFLARE_R2_BUCKET_REGION`: The Cloudflare R2 bucket region.
439+
- `CLOUDFLARE_R2_ACCESS_KEY_ID`: The Cloudflare R2 bucket access key id.
440+
441+
The following repository secrets must be set on GitHub Actions:
442+
443+
- `CLOUDFLARE_R2_SECRET_ACCESS_KEY`: The Cloudflare R2 secret access key.
444+
433445
[GitHub Actions]: https://github.com/features/actions
434446
[GPG private key]: https://github.com/marketplace/actions/import-gpg#prerequisites
435447

terraform/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ locals {
77
resource "cloudflare_r2_bucket" "main" {
88
account_id = var.cloudflare_account_id
99
name = join("-", [local.org, local.repo, local.id])
10-
location = "wnam"
10+
location = "WNAM"
1111
}

0 commit comments

Comments
 (0)