-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
1 changed file
with
21 additions
and
13 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 |
---|---|---|
|
@@ -15,11 +15,12 @@ on: | |
# Enable running this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
# Sets permissions of the GITHUB_TOKEN needed for deployment | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
deployments: write | ||
pull-requests: write | ||
statuses: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
|
@@ -67,7 +68,7 @@ jobs: | |
name: Deploy | ||
environment: | ||
name: netlify | ||
url: ${{ github.ref_name == 'master' && steps.publish.outputs.NETLIFY_LIVE_URL || steps.publish.outputs.NETLIFY_URL }} | ||
url: ${{ steps.publish.outputs.deploy-url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
|
@@ -81,16 +82,23 @@ jobs: | |
run: npm ci | ||
- name: Build Site | ||
run: npm run generate | ||
- id: alias | ||
name: Compute Deploy Alias | ||
if: github.ref_name != 'master' | ||
run: python3 -c 'import base64; print("alias="+base64.urlsafe_b64encode(bytes.fromhex("${{github.sha}}")).decode("utf-8").rstrip("="))' >> "$GITHUB_OUTPUT" | ||
- id: deploy-info | ||
name: Compute Deploy Info | ||
run: | | ||
set -e | ||
python3 -c 'import base64; print("alias="+base64.urlsafe_b64encode(bytes.fromhex("${{github.sha}}")).decode("utf-8").rstrip("="))' >> "$GITHUB_OUTPUT" | ||
echo "message=`git log -1 --pretty=format:"%s"`" >> "$GITHUB_OUTPUT" | ||
- id: publish | ||
name: Publish | ||
uses: netlify/actions/cli@master | ||
name: Publish to Netlify | ||
uses: nwtgck/actions[email protected] | ||
with: | ||
args: deploy --dir=.output/public \ | ||
${{ github.ref_name == 'master' && '--prod' || format('--alias={0}', steps.alias.outputs.alias) }} | ||
publish-dir: .output/public | ||
production-branch: master | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
deploy-message: | | ||
${{ github.event_name == 'pull_request' && format('pr {0}: {1}', github.event.number, steps.deploy-info.outputs.message) || steps.deploy-info.outputs.message }} | ||
alias: ${{ steps.deploy-info.outputs.alias }} | ||
env: | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
timeout-minutes: 1 |