deploy #35
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: Deploy | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [deploy] | |
push: | |
branches: | |
- master | |
- main | |
paths: | |
- '.github/workflows/deploy.yml' | |
concurrency: | |
group: deploy-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: π Setup node env | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- name: π Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: | | |
# shellcheck disable=SC2086 | |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: π¦ Cache node_modules | |
uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: π¨π»βπ» Install dependencies | |
run: yarn | |
- name: ποΈ Nuxt build | |
run: yarn build | |
env: | |
MICROCMS_API_URL: ${{ secrets.MICROCMS_API_URL }} | |
MICROCMS_API_KEY: ${{ secrets.MICROCMS_API_KEY }} | |
- name: π Nuxt generate | |
run: yarn generate | |
env: | |
MICROCMS_API_URL: ${{ secrets.MICROCMS_API_URL }} | |
MICROCMS_API_KEY: ${{ secrets.MICROCMS_API_KEY }} | |
- name: π Upload Pages-artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: dist | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: π Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |