blog add blog #26
This file contains 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: Azure Static Web Apps CI/CD | |
on: | |
push: | |
branches: | |
- main | |
env: | |
working-directory: "blog-app" | |
jobs: | |
build_and_deploy_job: | |
runs-on: ubuntu-latest | |
name: Build and Deploy Job | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
cache: "pnpm" | |
cache-dependency-path: ${{ env.working-directory }}/pnpm-lock.yaml | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
working-directory: ${{ env.working-directory }} | |
- name: Build and Export | |
run: pnpm run export | |
working-directory: ${{ env.working-directory }} | |
- name: Deploy | |
run: pnpm run deploy:prod | |
working-directory: ${{ env.working-directory }} | |
env: | |
SWA_CLI_DEPLOYMENT_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_VICTORIOUS_ROCK_0DBAC5500 }} |