-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (63 loc) · 2.14 KB
/
deploy-stage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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