Skip to content

Commit

Permalink
ci: deploy to netlify (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen authored Jun 7, 2024
1 parent 33e9483 commit d0da4d8
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,34 @@ jobs:
path: ../oxc/npm/oxc-wasm

- run: pnpm run build

- name: Install Netlify
run: pnpm install -g netlify-cli@17.10.1

# https://www.raulmelo.me/en/blog/deploying-netlify-github-actions-guide
- name: Deploy to Netlify
id: netlify_deploy
run: |
prod_flag=""
if [ "${{ github.ref_name }}" = "main" ]; then prod_flag="--prod"; fi
netlify deploy \
--dir dist \
--site ${{ secrets.NETLIFY_SITE_ID }} \
--auth ${{ secrets.NETLIFY_API_TOKEN }} \
$prod_flag \
--json \
> deploy_output.json
- name: Generate URL Preview
id: url_preview
if: ${{ env.github_refname != 'main' }}
run: |
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json)
echo "NETLIFY_PREVIEW_URL=$NETLIFY_PREVIEW_URL" >> $GITHUB_OUTPUT
- uses: peter-evans/create-or-update-comment@v4
if: ${{ env.github_refname != 'main' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.number }}
body: "Preview URL: ${{ steps.url_preview.outputs.NETLIFY_PREVIEW_URL }}"

0 comments on commit d0da4d8

Please sign in to comment.