Skip to content

bump: version 0.2.0a4 → 0.2.0a5 #54

bump: version 0.2.0a4 → 0.2.0a5

bump: version 0.2.0a4 → 0.2.0a5 #54

Workflow file for this run

name: 🚩 Deploy to CDN
on:
push:
branches:
- main
tags:
- "*"
# Workflow is triggered only if src changes
paths:
- components/**
# Allow manual trigger (workflow_dispatch)
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: Install dependencies
working-directory: .
run: CI=true pnpm install
- name: Build Dist
working-directory: .
run: pnpm build
- name: Upload to GH Pages
run: |
# Debug info
echo "Content of repo:"
ls -lahs "${{ github.workspace }}"
echo ""
echo "Current dir: ${PWD}"
# Checkout to gh-pages
mkdir tmp_pages
cd tmp_pages
git init --initial-branch=gh-pages
git config user.name svchot
git config user.email [email protected]
git pull https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git gh-pages
mkdir -p dist
rsync -av \
--include='components/*.js' \
--include='components/*.d.ts' \
--include='react/*.js' \
--include='react/*.d.ts' \
--include='theme/*' \
--include='i18n/*' \
--exclude='*' \
"${{ github.workspace }}/" ./dist/
# Add a dummy file to ensure something to commit (prevent exit 1)
echo "$(date)" > .timestamp
# Push content to gh-pages
git add .
git commit -m "docs: update component dist to latest"
git push --set-upstream https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:gh-pages
- name: Configure AWS Creds
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_OIDC_ROLE }}
aws-region: us-east-1
- name: Upload to S3
env:
# latest for main branch, else tag name
S3_PATH: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
run: |
# Sync the necessary files to S3
aws s3 sync --delete \
--exclude "*" \
--include "components/*.js" \
--include='components/*.d.ts' \
--include "react/*.js" \
--include='react/*.d.ts' \
--include "theme/*.css" \
--include "i18n/*.xliff" \
${{ github.workspace }} \
s3://${{ vars.S3_BUCKET_NAME }}/${{ env.S3_PATH }}/