mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-16 18:31:40 -07:00
Fix Github Actions deploy for merges to main
Addresses part of #125 - merges to main now go to a path with a `main` prefix
This commit is contained in:
parent
589ec483e3
commit
6f4087d247
1 changed files with 18 additions and 8 deletions
26
.github/workflows/build_deploy.yml
vendored
26
.github/workflows/build_deploy.yml
vendored
|
@ -27,11 +27,16 @@ jobs:
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
- name: Set GITHUB_SHA_SHORT
|
|
||||||
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
|
|
||||||
# If this is just a PR branch, put content in a hash directory. Otherwise, put it in "main"
|
# If this is just a PR branch, put content in a hash directory. Otherwise, put it in "main"
|
||||||
- name: Set DESTINATION_FOLDER
|
# This variable is used by gatsby-config.js to set a prefixPath
|
||||||
run: echo "DESTINATION_FOLDER=${{ github.event.pull_request.merged == 'true' && 'main' || env.GITHUB_SHA_SHORT }}" >> $GITHUB_ENV
|
- name: Set DESTINATION_FOLDER for main
|
||||||
|
if: ${{ github.event.pull_request.merged == true }}
|
||||||
|
run: |
|
||||||
|
echo "DESTINATION_FOLDER=main" >> $GITHUB_ENV
|
||||||
|
- name: Set DESTINATION_FOLDER for branch
|
||||||
|
if: ${{ github.event.pull_request.merged != true }}
|
||||||
|
run: |
|
||||||
|
echo "DESTINATION_FOLDER=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
|
||||||
- name: Install
|
- name: Install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Build
|
- name: Build
|
||||||
|
@ -65,11 +70,15 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: J40Static
|
name: J40Static
|
||||||
path: ./public
|
path: ./public
|
||||||
- name: Set GITHUB_SHA_SHORT
|
|
||||||
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
|
|
||||||
# If this is just a PR branch, put content in a hash directory. Otherwise, put it in "main"
|
# If this is just a PR branch, put content in a hash directory. Otherwise, put it in "main"
|
||||||
- name: Set DESTINATION_FOLDER
|
- name: Set DESTINATION_FOLDER for main
|
||||||
run: echo "DESTINATION_FOLDER=${{ github.event.pull_request.merged == 'true' && 'main' || env.GITHUB_SHA_SHORT }}" >> $GITHUB_ENV
|
if: ${{ github.event.pull_request.merged == true }}
|
||||||
|
run: |
|
||||||
|
echo "DESTINATION_FOLDER=main" >> $GITHUB_ENV
|
||||||
|
- name: Set DESTINATION_FOLDER for branch
|
||||||
|
if: ${{ github.event.pull_request.merged != true }}
|
||||||
|
run: |
|
||||||
|
echo "DESTINATION_FOLDER=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
|
||||||
- name: Deploy to Github Pages
|
- name: Deploy to Github Pages
|
||||||
uses: JamesIves/github-pages-deploy-action@4.1.0
|
uses: JamesIves/github-pages-deploy-action@4.1.0
|
||||||
with:
|
with:
|
||||||
|
@ -77,6 +86,7 @@ jobs:
|
||||||
BRANCH: gh-pages # The branch the action should deploy to.
|
BRANCH: gh-pages # The branch the action should deploy to.
|
||||||
FOLDER: public # The folder the action should deploy.
|
FOLDER: public # The folder the action should deploy.
|
||||||
TARGET-FOLDER: ${{env.DESTINATION_FOLDER}} # If we're on a PR branch, merge to PR folder
|
TARGET-FOLDER: ${{env.DESTINATION_FOLDER}} # If we're on a PR branch, merge to PR folder
|
||||||
|
CLEAN: true
|
||||||
- name: Configure AWS Credentials
|
- name: Configure AWS Credentials
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
with:
|
with:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue