Update SCSS variables from Figma #178
This file contains hidden or 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 to GitHub Pages | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
# tack on branch name to allow for cross-branch concurrency | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
issues: write | |
pull-requests: write | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
deploy_path: ${{ steps.set-vars.outputs.deploy_path }} | |
steps: | |
- id: set-vars | |
shell: bash | |
run: | | |
# Replace slashes with dashes in branch name | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
BRANCH_NAME="${{ github.head_ref }}" | |
else | |
BRANCH_NAME="${{ github.ref_name }}" | |
fi | |
# Replace slashes with dashes for safety | |
DEPLOY_PATH="${BRANCH_NAME//\//-}" | |
echo "deploy_path=$DEPLOY_PATH" >> $GITHUB_OUTPUT | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
needs: setup | |
environment: | |
name: "preview-${{ needs.setup.outputs.deploy_path }}" | |
url: "${{ steps.build-publish.outputs.page_url }}${{ needs.setup.outputs.deploy_path }}" | |
steps: | |
- id: build-publish | |
uses: bitovi/[email protected] | |
env: | |
BUILD_PATH: preview-out # change to your build folder | |
DEPLOY_PATH: ${{ needs.setup.outputs.deploy_path }} | |
with: | |
path: ${{ env.BUILD_PATH }} | |
build_command: | | |
npm run build | |
# Create preview directory structure | |
mkdir -p "$BUILD_PATH/${DEPLOY_PATH}" | |
cp -r dist/* "$BUILD_PATH/${DEPLOY_PATH}/" | |
# Copy 404.html to root for routing | |
cp dist/404.html $BUILD_PATH/ | |
- name: Comment on PR | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
if(context.issue && context.issue.number){ | |
github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: `🎉 **Preview Deployed!** | |
👉 <a href="${{ steps.build-publish.outputs.page_url }}${{ needs.setup.outputs.deploy_path }}" target="_blank">View Preview</a>` | |
}); | |
} |