chore(CI): add github workflow #20
This file contains hidden or 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: ci | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: ${{ vars.URL }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup bun | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- name: Install bun deps | |
run: bun install | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: node-${{ runner.os }}-${{ hashFiles('**/bun.lock') }} | |
restore-keys: | | |
node-${{ runner.os }}- | |
node- | |
- name: Bun build | |
run: bun run build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ github.run_id }}-${{ github.run_attempt }} | |
path: dist | |
- name: Azure CLI Login | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Upload static files to Azure Storage | |
uses: azure/cli@v2 | |
with: | |
inlineScript: | | |
az storage blob sync --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --auth-mode login -c '$web' -s dist --delete-destination true |