-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (36 loc) · 1.75 KB
/
on-pr.yaml
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
name: On Pull Request
env:
BUCKET_NAME: 'techday-2022-2-staging'
AWS_REGION: 'us-east-1'
on: pull_request
jobs:
sync-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Replace QSS3BucketName and QSS3KeyPrefix
shell: bash
run: |
pip install jq yq
sed -e '/QSS3KeyPrefix/!b' -e ':a' -e "s/Default: $(cat templates/main.template.yaml | yq .Parameters.QSS3KeyPrefix.Default | sed -e 's/[\/&]/\\&/g')/Default: ${{ github.sha }}\//;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' templates/main.template.yaml > templates/TEMP.main.template.yaml && sed -e '/QSS3BucketName/!b' -e ':a' -e "s/Default: $(cat templates/TEMP.main.template.yaml | yq -r .Parameters.QSS3BucketName.Default)/Default: ${{ env.BUCKET_NAME }}/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' templates/TEMP.main.template.yaml > templates/main.template.yaml
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete --exclude '.git/*' --exclude '.git/github'
env:
AWS_S3_BUCKET: ${{ env.BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ env.AWS_REGION }}
DEST_DIR: ${{ github.sha }}
- name: Installing Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Deploy to Vending Machine
env:
CFN_URL: 'https://${{ env.BUCKET_NAME }}.s3.amazonaws.com/${{ github.sha }}/templates/main.template.yaml'
VM_API_KEY: ${{ secrets.VM_API_KEY }}
working-directory: .github/workflows/setup-account-using-vending-machine
run: |
npm ci
node setup-account-using-vending-machine.js