frontend #700
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: frontend | |
on: | |
workflow_call: | |
workflow_dispatch: | |
workflow_run: | |
workflows: [schedule, ci] | |
types: [completed] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: pnpm/action-setup@v2 | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --no-frozen-lockfile | |
- name: git config | |
run: | | |
git config --local user.name '${{github.actor}}' | |
git config --local user.email 'github-action-${{github.actor}}@users.noreply.github.com' | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files | |
- name: date | |
run: | | |
export TZ="Etc/GMT-9" | |
current_datetime=$(date --rfc-email) | |
echo "current_datetime=${current_datetime}" >> $GITHUB_ENV | |
# 데이터 갱신된 날짜를 index.html에도 반영하고 싶다 | |
- name: build | |
run: | | |
(cd ./packages/frontend && pnpm build) | |
bash ./scripts/replace_datetime.sh | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
commit_message: 'deploy: ${{ env.current_datetime }}' | |
publish_branch: gh-pages | |
publish_dir: ./packages/frontend/dist/ |