231122: 마스터즈 페이지에 지원하기 카드 추가, 마스터즈 수료생 후기를 홈에도 반영 #30
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: CI/CD master | |
on: | |
push: | |
branches: [master] | |
env: | |
CACHED_DEPENDENCY_PATHS: ./node_modules | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: master | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "14" | |
- name: Compute dependency cache key | |
id: compute_lockfile_hash | |
run: echo "::set-output name=hash::${{ hashFiles('package-lock.json') }}" | |
- name: Check dependency cache | |
uses: actions/cache@v2 | |
id: cache_dependencies | |
with: | |
path: ${{ env.CACHED_DEPENDENCY_PATHS }} | |
key: master-${{ steps.compute_lockfile_hash.outputs.hash }} | |
- name: Install dependencies if cache not exist | |
if: steps.cache_dependencies.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Run test | |
run: npm run test | |
outputs: | |
dependency_cache_key: master-${{ steps.compute_lockfile_hash.outputs.hash }} | |
staging-deploy: | |
runs-on: ubuntu-latest | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: master | |
fetch-depth: 0 | |
- name: Check dependency cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.CACHED_DEPENDENCY_PATHS }} | |
key: ${{ needs.test.outputs.dependency_cache_key }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "14" | |
- name: Build gatsby application | |
run: npm run build | |
- name: Declare commit id use on s3 upload | |
id: vars | |
shell: bash | |
run: | | |
echo "GITHUB_SHA: ${GITHUB_SHA}" | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: AWS S3 Deploy | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: codesquad.kr | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "ap-northeast-2" | |
SOURCE_DIR: "./public" | |
- name: Slack Notification | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,commit,message,author,action,ref | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} |