Skip to content

Commit

Permalink
Add GitHub Actions workflow for building and uploading registry site
Browse files Browse the repository at this point in the history
- Create a new workflow in build_site.yaml to handle the build and upload process for the registry site to Cloudflare R2.
- Move the upload registry step from build_tools.yaml to the new workflow for better organization.
- Update PackageList.js to handle null package versions gracefully and enhance author display with improved styling.
  • Loading branch information
guillevalin committed Dec 21, 2024
1 parent 2f44933 commit d6efc49
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build_site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Registry Site

on:
workflow_dispatch:

jobs:
build_tools:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3

- name: Upload registry
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_BUCKET: ${{ secrets.R2_BUCKET }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
cd registry
npm ci
npm run build
export AWS_ACCESS_KEY_ID=${R2_ACCESS_KEY_ID}
export AWS_SECRET_ACCESS_KEY=${R2_SECRET_ACCESS_KEY}
export AWS_ENDPOINT_URL=https://${CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com
aws s3 sync ./build/ s3://${R2_BUCKET}/ \
--endpoint-url https://${CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com \
--only-show-errors
13 changes: 0 additions & 13 deletions .github/workflows/build_tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,3 @@ jobs:
--endpoint-url https://${CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com \
--only-show-errors
- name: Upload registry
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_BUCKET: ${{ secrets.R2_BUCKET }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
cd registry
npm ci
npm run build
aws s3 sync ./build/ s3://${R2_BUCKET}/ \
--endpoint-url https://${CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com \
--only-show-errors
9 changes: 7 additions & 2 deletions registry/src/components/PackageList.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function PackageList({ searchQuery }) {
borderRadius: 1,
}}
>
v{pkg.version}
{pkg.version != 'null' ? pkg.version : '0.0.0' }
</Typography>
</Box>
<Typography variant="body1" color="text.secondary" paragraph>
Expand All @@ -98,9 +98,14 @@ function PackageList({ searchQuery }) {
variant="caption"
sx={{
color: 'text.secondary',
display: 'inline-block',
backgroundColor: 'rgba(255, 255, 255, 0.05)',
px: 1,
py: 0.5,
borderRadius: 1,
}}
>
By {pkg.author}
<b>Author</b>: {pkg.author}
</Typography>
)}
</Stack>
Expand Down

0 comments on commit d6efc49

Please sign in to comment.