-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24971c2
commit 136a11b
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: 'Netlify Deploy' | ||
|
||
on: | ||
# release: | ||
# types: [published] | ||
push: | ||
# branches: | ||
# - main | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.ref_name }} | ||
SITE_ID: "reece-icf-docs-site" # TODO: this should be a secret for prod? | ||
|
||
jobs: | ||
deploy: | ||
name: 'Deploy to Netlify' | ||
runs-on: ubuntu-latest | ||
steps: | ||
# - uses: jsmrcaga/[email protected] | ||
# with: | ||
# | ||
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
# NETLIFY_DEPLOY_MESSAGE: "Prod deploy v${{ github.ref }}" | ||
# NETLIFY_DEPLOY_TO_PROD: true | ||
|
||
- name: Repository Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup NodeJS | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
|
||
- name: Install Netlify | ||
run: npm install [email protected] -g | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: 🤔 Sync latest Upstream | ||
run: make sync-docs | ||
|
||
- name: Build website 🔨 | ||
run: make build-docs | ||
|
||
# https://app.netlify.com/user/applications#personal-access-tokens | ||
# ref: https://www.raulmelo.me/en/blog/deploying-netlify-github-actions-guide | ||
- name: Deploy to Netlify | ||
id: netlify_deploy | ||
run: | | ||
prod_flag="" | ||
if [ "$BRANCH_NAME" = "main" ]; then prod_flag="--prod"; fi | ||
netlify deploy \ | ||
--dir dist \ | ||
--site ${{ env.SITE_ID }} \ | ||
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \ | ||
$prod_flag \ | ||
--json | ||
> deploy_output.json | ||
- name: Generate URL Preview | ||
id: url_preview | ||
if: ${{ env.BRANCH_NAME != 'main' }} | ||
run: | | ||
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json) | ||
echo "NETLIFY_PREVIEW_URL=$NETLIFY_PREVIEW_URL" >> "$GITHUB_OUTPUT" | ||
- name: DEBUG=WILL BE REMOVED | ||
run: echo ${{ steps.url_preview.outputs.NETLIFY_PREVIEW_URL }} |