-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (37 loc) · 1.3 KB
/
deploy.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
name: Deploy to s3
on:
push:
branches:
- staging
- main
jobs:
build:
name: Build files
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- name: Set global variables for staging/production
id: global-vars
run: |
if [[ ${{ github.ref }} = refs/heads/staging ]];then
echo ::set-output name=aws_env_prefix::staging
else
echo ::set-output name=aws_env_prefix::prod
fi
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- uses: actions/checkout@master
- name: Deploy to s3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
run: |
aws s3 sync specs "s3://${{ steps.global-vars.outputs.aws_env_prefix }}-phila-gov-website-s3/departments/office-of-human-resources/job-specs/" --delete
if [[ ${{ github.ref }} = refs/heads/staging ]];then
aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_INVALIDATE_STAGE }} --paths "/*"
else
aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_INVALIDATE_PROD }} --paths "/*"
fi