Skip to content

Commit

Permalink
feat(actions): Add input field
Browse files Browse the repository at this point in the history
  • Loading branch information
1ilsang committed Jun 2, 2024
1 parent 05a2483 commit de06342
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
15 changes: 10 additions & 5 deletions .github/actions/netlify-preview/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: netlify-preview

inputs:
NETLIFY_SITE_ID:
required: true
NETLIFY_API_TOKEN:
required: true

runs:
using: composite

Expand All @@ -9,23 +15,22 @@ runs:
id: netlify-deploy
shell: bash
run: |
pnpm nf \
pnpm nf deploy \
--dir out \
--site ${{ secrets.NETLIFY_SITE_ID }} \
--auth ${{ secrets.NETLIFY_API_TOKEN }} \
--site ${{ inputs.NETLIFY_SITE_ID }} \
--auth ${{ inputs.NETLIFY_API_TOKEN }} \
--json \
> deploy_output.json
- name: Generate URL Preview
id: url-preview
if: ${{ env.BRANCH_NAME == 'main' }}
shell: bash
run: |
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json)
echo "NETLIFY_PREVIEW_URL=$NETLIFY_PREVIEW_URL" >> "$GITHUB_OUTPUT"
- name: Comment URL Preview on PR
uses: actions/github-script@v7
if: ${{ env.BRANCH_NAME == 'main' }}
env:
NETLIFY_PREVIEW_URL: ${{ steps.url-preview.outputs.NETLIFY_PREVIEW_URL }}
with:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,14 @@ jobs:
steps:
- uses: actions/checkout@v4

# 캐싱 된 값을 사용
- name: 🌱 Install pnpm
uses: ./.github/actions/pnpm-install
- name: 🏗 Build and Export
uses: ./.github/actions/nextjs-build-export

- name: 🌈 Netlify preview
uses: ./.github/actions/netlify-preview
with:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_API_TOKEN: ${{ secrets.NETLIFY_API_TOKEN }}
Loading

0 comments on commit de06342

Please sign in to comment.