Add 1021 (#143) #140
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
name: Sync to S3 | |
on: | |
push: | |
branches: | |
- master | |
env: | |
AWS-REGION: ap-southeast-1 | |
AWS-URL: beta-programming-in-th | |
AWS_ACCESS_KEY_ID: ${{ secrets.OLD_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.OLD_AWS_SECRET_ACCESS_KEY }} | |
BUCKET_NAME: prginth01 | |
jobs: | |
deploy: | |
name: Upload to Digital Ocean S3 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Change relative path to absolute path | |
run: sed -i -e 's+../media/+https://${{ env.BUCKET_NAME }}.sgp1.cdn.digitaloceanspaces.com/solutions/media/+g' * | |
working-directory: ./md | |
- name: Set up S3cmd cli tool | |
uses: s3-actions/[email protected] | |
with: | |
provider: digitalocean | |
region: "sgp1" | |
access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Copy files to S3 with the AWS CLI | |
run: | | |
s3cmd sync --recursive --acl-public --exclude "*" --include "md/*" --include "media/*" . s3://${{ env.BUCKET_NAME }}/solutions/ | |
deploy_legacy: | |
name: Upload to Amazon S3 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Change relative path to absolute path | |
run: sed -i -e 's+../media/+https://${{ env.AWS-URL }}.s3-${{ env.AWS-REGION }}.amazonaws.com/solutions/media/+g' * | |
working-directory: ./md | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS-REGION }} | |
- name: Copy files to S3 with the AWS CLI | |
run: | | |
aws s3 sync . s3://${{ env.AWS-URL }}/solutions --exclude "*" --include "md/*" --include "media/*" --acl public-read |