feat: netlify deploy badge #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: deploy | |
on: | |
push: | |
branches: [main, develop] | |
workflow_dispatch: | |
env: | |
PROD_FLAG: ${{ github.ref_name == 'main' && '--prod' || '' }} | |
jobs: | |
build: | |
uses: ./.github/workflows/build.yml | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: netlify | |
url: ${{ steps.deploy_url.outputs.URL }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: apps/website/dist | |
- name: install netlify | |
run: npm install netlify-cli@17.10.1 -g | |
- name: deploy to netlify | |
id: netlify_deploy | |
run: | | |
netlify deploy \ | |
--filter website \ | |
--dir apps/website/dist \ | |
--site ${{ secrets.NETLIFY_SITE_ID }} \ | |
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \ | |
$PROD_FLAG \ | |
--json \ | |
> result.json | |
- name: generate deploy URL | |
id: deploy_url | |
run: | | |
URL=$(jq -r '.deploy_url' result.json) | |
echo "URL=$URL" >> "$GITHUB_OUTPUT" |