Skip to content

Update 1-3-1.md

Update 1-3-1.md #6713

name: Deploy feature branch to S3
on:
push:
branches:
- 'feature-*'
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
steps:
- name: Cancel all existing duplicate workflows on branch
uses: fkirc/skip-duplicate-actions@master
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
skip_after_successful_duplicate: 'false'
cancel_others: 'true'
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: Build data
run: |
python scripts/build_data.py
- name: Delete zip files
run: |
rm _site/untranslated/zip/all_indicators.zip
rm _site/en/zip/all_indicators.zip
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Push data build to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
# Update this according to the name of your S3 bucket.
AWS_S3_BUCKET: uk-sdg-feature-branches
# Remember to add AWS_ACCESS as a "repository secret".
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS }}
# Remember to add AWS_SECRET as a "repository secret".
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET }}
SOURCE_DIR: _site
DEST_DIR: ${{ env.GITHUB_REF_SLUG }}-data
- name: Trigger a site build
env:
# Enter your Github username (or the username of whomever owns
# the personal access token being used).
GITHUB_USERNAME: lucygwilliamadmin
# Enter your Github organization (maybe the same as your username).
GITHUB_ORG: onsdigital
# Enter the site repository name
GITHUB_SITE_REPO: sdg-indicators
# Remember to create a personal access token and set it as a
# repository secret called "token".
ACCESS_TOKEN: ${{ secrets.token }}
SITE_BRANCH: ${{ env.GITHUB_REF_SLUG }}
run: |
git clone https://$GITHUB_USERNAME:[email protected]/$GITHUB_ORG/$GITHUB_SITE_REPO
cd $GITHUB_SITE_REPO
git config user.name "Feature branch server"
git config user.email "[email protected]"
git checkout $SITE_BRANCH 2>/dev/null || git checkout -b $SITE_BRANCH
git commit --allow-empty -m "Trigger build"
git push origin $SITE_BRANCH