Update README.md (#200) #32
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: Deployment | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'LAST_UPDATED' | |
- 'data.json' | |
- 'data.js' | |
- 'data-es.js' | |
- 'tags.txt' | |
- 'tags-prefix.txt' | |
- '_redirect-out' | |
- 'package.json' | |
jobs: | |
deploy-to-prod: | |
if: github.repository == 'phpid-jakarta/phpid-learning' | |
name: Deploy to production | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- uses: pnpm/[email protected] | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 7.5.1 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Generate file json | |
run: pnpm run script:toJson | |
- name: Generate QnA json | |
run: pnpm run script:qna | |
- name: Modify last update | |
run: | | |
d=`date '+%Y-%m-%dT%H:%M:%SZ'` | |
echo $d > LAST_UPDATED | |
- name: Perform export to static | |
run: pnpm run sync && pnpm run build | |
- name: Deploy UI to prod | |
uses: peaceiris/[email protected] | |
with: | |
personal_token: ${{ secrets.PERSONAL_TOKEN }} | |
publish_dir: ./build | |
publish_branch: netlify-pages | |
full_commit_message: ${{ github.event.head_commit.message }} | |
force_orphan: true | |
- name: Deploy API to prod | |
uses: peaceiris/[email protected] | |
with: | |
personal_token: ${{ secrets.PERSONAL_TOKEN }} | |
publish_dir: ./api | |
publish_branch: api | |
- uses: actions/cache@v3 | |
name: Cache project | |
with: | |
path: '.' | |
key: ${{ runner.os }}-${{ github.sha }}-cache-project | |
restore-keys: | | |
${{ runner.os }}-${{ github.sha }}-cache-project |