-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Action deployment (#1653)
Add GitHub Action deployment Add a deploy.yml file and connect it to the build_and_deploy workflow. Comment out the corresponding build_and_deploy from CircleCI. When the migration is complete, we can delete the commented out portions from the CircleCI config. I added the AWS credentials to the repo's secrets. I also set up branch name formatting where any '/' is replaced with '-' in order to match the CircleCI behavior. J=SLAP-1816 TEST=manual Observe the build and deploy in the Github Actions panel. Point the theme test site to the assets and see the page work correctly.
- Loading branch information
Showing
3 changed files
with
103 additions
and
31 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Deploy assets to AWS S3 | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
bucket: | ||
required: false | ||
type: string | ||
default: answers | ||
directory: | ||
required: true | ||
type: string | ||
cache-control: | ||
required: false | ||
type: string | ||
default: no-cache | ||
secrets: | ||
AWS_ACCESS_KEY_ID: | ||
required: true | ||
AWS_SECRET_ACCESS_KEY: | ||
required: true | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Download build-output artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: build-output | ||
path: dist/ | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
- name: Deploy to S3 | ||
run: | | ||
aws s3 cp ./dist/ s3://assets.sitescdn.net/${{ inputs.bucket }}/${{ inputs.directory }} \ | ||
--acl public-read \ | ||
--recursive \ | ||
--cache-control ${{ inputs.cache-control }} |