Skip to content

Commit

Permalink
chore: github action ์„ค์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
urjimyu committed May 5, 2024
1 parent 3742e5e commit 7c2a0e9
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy

on:
# main ๋ธŒ๋žœ์น˜์— ํ‘ธ์‹œํ•˜๋ฉด ํŒ€ ๋ ˆํฌ forkํ•œ ๊ฐœ์ธ ๋ ˆํฌ Vercel ์ž๋™ ๋ฐฐํฌ๋˜๋„๋ก ์„ค์ •
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
container: pandoc/latex
steps:
# workflow์— ์†ํ•œ ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •
- name: Checkout repository
uses: actions/checkout@v4

- name: Install mustache (to update the date)
run: apk add ruby && gem install mustache

- name: creates output
run: sh ./build.sh

- name: Pushes to another repository
id: push_directory
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.AUTH_TOKEN }}
with:
source-directory: 'output'
destination-github-username: urjimyu
destination-repository-name: RecorDream-Web
user-email: ${{ secrets.OFFICIAL_ACCOUNT_EMAIL }}
commit-message: ${{ github.event.commits[0].message }}
target-branch: main

- name: Test get variable exported by push-to-another-repository
run: echo $DESTINATION_CLONED_DIRECTORY
46 changes: 46 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: pr-preview
on:
# main, develop ๋ธŒ๋žœ์น˜๋ฅผ ํ–ฅํ•ด PR ์˜ฌ๋ฆฌ๋ฉด ์ž„์‹œ ๋ฐฐํฌ๋˜๋„๋ก ์„ค์ •
pull_request:
types:
- opened
- reopened
- synchronize

branches: [main, develop]

# ๊ถŒํ•œ ์„ค์ •
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
pages: write
deployments: write

# ๋™์‹œ์„ฑ ์„ค์ •
concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
# workflow์— ์†ํ•œ ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •
- name: Checkout
uses: actions/checkout@v4

- run: echo "PREVIEW_PATH=pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV"

# ์ข…์†์„ฑ ์„ค์น˜ ๋ฐ ํ”„๋กœ์ ํŠธ ๋นŒ๋“œ
- name: Install and Build
run: yarn install && yarn build

# PR ํ”„๋ฆฌ๋ทฐ ๋ฐฐํฌ
- name: Deploy PR Preview
uses: rossjrw/pr-preview-action@v1.4.6
with:
token: ${{ secrets.AUTH_TOKEN}}
source-dir: ./dist/
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
cd ../
mkdir output
cp -R ./RecorDream-Web/* ./output
cp -R ./output ./RecorDream-Web/

0 comments on commit 7c2a0e9

Please sign in to comment.