-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (68 loc) · 2.64 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
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
name: Deploy Process
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: Firenza/[email protected]
with:
secrets: ${{ toJSON(secrets) }}
- name: Specify PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '5.6'
- name: Make branch name available as Bash variable
run: echo "GITHUB_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- run: >-
sudo apt-get update &&
sudo apt-get install -y awscli php5.6-cli php5.6-curl php5.6-memcached php5.6-mysql yarn zip
- uses: actions/checkout@v2
- run: sudo apt-get update -qq
- run: git clone -b deploy https://github.com/openva/richmondsunlight.com.git
- run: cd richmondsunlight.com && composer install && cd ..
- run: mkdir includes/
- run: cp richmondsunlight.com/htdocs/includes/*.php includes/
- run: rm -Rf richmondsunlight.com
- run: composer install
- run: cd htdocs/js/vendor; yarn build
- run: cd ../../..
- run: find htdocs/*.php -print0 |xargs -0 -n1 -P8 php5.6 -l
- run: cd deploy/tests/ && php bills.php && php committee_members.php && php legislators.php && cd ../..
- run: >-
./deploy/config_variables.sh && ./deploy/aws_credentials.sh
&& ./deploy/sftp_credentials.sh && zip -qr rs-machine . --exclude
*.git* *.scannerwork* && mkdir -p upload && mv latest.zip
upload/latest.zip
- name: Save secret-populated code for a subsequent deploy step
uses: actions/upload-artifact@v2
with:
name: codebase
path: .
outputs:
github_branch: ${{ steps.get_branch.outputs.github_branch }}
deploy:
runs-on: ubuntu-20.04
needs: build # Don't deploy unless the build succeeds
steps:
- name: Get the secret-populated code
uses: actions/download-artifact@v2
with:
name: codebase
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: us-east-1
- name: Staging CodeDeploy Deployment
if: ${{ needs.build.outputs.github_branch == 'master' }}
run: |
aws deploy create-deployment \
--application-name RS-Machine \
--deployment-group-name RS-Machine-Fleet \
--deployment-config-name CodeDeployDefault.OneAtATime \
--github-location repository=${{ github.repository }},commitId=${{ github.sha }}