Skip to content

Merge pull request #3 from calimania/feat/deploying-by-action #9

Merge pull request #3 from calimania/feat/deploying-by-action

Merge pull request #3 from calimania/feat/deploying-by-action #9

Workflow file for this run

name: Build and Deploy
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
workflow_dispatch:
env:
REACT_APP_STRAPI_URL: ${{ secrets.STRAPI_URL }}
REACT_APP_STORE_SLUG: ${{ secrets.STORE_SLUG }}
permissions:
contents: write
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: github-pages-${{ github.run_id }}
path: ./build
retention-days: 1
deploy:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages-${{ github.run_id }}
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4