Update README.md #103
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
name: Deploy to staging | |
concurrency: | |
group: deploy-stage-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "**" # always deploy for branches | |
tags-ignore: | |
- "**" # never deploy for tags | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
- name: Use Node.js 14.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
- name: npm install | |
run: npm ci --production | |
- id: delivery-path-prefix | |
name: Prepare the Delivery path prefix | |
uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
script: | | |
// import path module | |
const path = require('path'); | |
// get reference to this commit | |
const ref = context.ref; | |
// get repo that triggered this push | |
const { repo } = context.repo; | |
// pull branch name off the ref | |
const parts = ref.split('/'); | |
const branch = parts[parts.length - 1]; | |
// build path used for this deploy | |
const basePath = path.join(repo, branch); | |
// return the prepared path as the output | |
return basePath; | |
- name: Build the project | |
run: npm run build | |
env: | |
BAKER_PATH_PREFIX: ${{ steps.delivery-path-prefix.outputs.result }} | |
# - name: Configure AWS Credentials | |
# uses: aws-actions/configure-aws-credentials@v1 | |
# with: | |
# aws-access-key-id: ${{ secrets.BAKER_AWS_ACCESS_KEY_ID }} | |
# aws-secret-access-key: ${{ secrets.BAKER_AWS_SECRET_ACCESS_KEY }} | |
# aws-region: ${{ secrets.BAKER_AWS_S3_STAGING_REGION }} | |
# - name: Upload the prepared files | |
# uses: datadesk/delivery-deploy-action@v1 | |
# with: | |
# bucket: ${{ secrets.BAKER_AWS_S3_STAGING_BUCKET }} | |
# base-path: ${{ steps.delivery-path-prefix.outputs.result }} | |
# dir: _dist | |
# should-cache: true | |
# use-accelerate-endpoint: false | |
# public: true |