mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-22 17:44:20 -08:00
Adding SHA (for PRs)/ Main (for main) to URL (#121)
* Fixes #90 - adds a GHA SHA to PR branches and 'main' for merges to main
This commit is contained in:
parent
7ab14c7f3d
commit
9ea0f946eb
2 changed files with 13 additions and 2 deletions
13
.github/workflows/build_deploy.yml
vendored
13
.github/workflows/build_deploy.yml
vendored
|
@ -27,6 +27,11 @@ jobs:
|
|||
uses: actions/setup-node@v2
|
||||
with:
|
||||
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"
|
||||
- name: Set DESTINATION_FOLDER
|
||||
run: echo "DESTINATION_FOLDER=${{ github.event.pull_request.merged == 'true' && 'main' || env.GITHUB_SHA_SHORT }}" >> $GITHUB_ENV
|
||||
- name: Install
|
||||
run: npm ci
|
||||
- name: Build
|
||||
|
@ -59,12 +64,18 @@ jobs:
|
|||
with:
|
||||
name: J40Static
|
||||
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"
|
||||
- name: Set DESTINATION_FOLDER
|
||||
run: echo "DESTINATION_FOLDER=${{ github.event.pull_request.merged == 'true' && 'main' || env.GITHUB_SHA_SHORT }}" >> $GITHUB_ENV
|
||||
- name: Deploy to Github Pages
|
||||
uses: JamesIves/github-pages-deploy-action@4.1.0
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages # The branch the action should deploy to.
|
||||
FOLDER: public # The folder the action should deploy.
|
||||
TARGET-FOLDER: ${{env.DESTINATION_FOLDER}} # If we're on a PR branch, merge to PR folder
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
|
@ -72,4 +83,4 @@ jobs:
|
|||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: us-east-1
|
||||
- name: Deploy to Geoplatform AWS
|
||||
run: aws s3 sync ./public/ s3://usds-geoplatform-justice40-website/justice40-tool --delete
|
||||
run: aws s3 sync ./public/ s3://usds-geoplatform-justice40-website/justice40-tool/${{env.DESTINATION_FOLDER}} --delete
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
siteMetadata: {
|
||||
title: 'Justice40',
|
||||
},
|
||||
pathPrefix: '/justice40-tool',
|
||||
pathPrefix: `/justice40-tool/${process.env.DESTINATION_FOLDER}`,
|
||||
plugins: [
|
||||
{
|
||||
resolve: 'gatsby-plugin-sass',
|
||||
|
|
Loading…
Add table
Reference in a new issue