Merge pull request #3698 from ONSdigital/feature-15-9-1 #932
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
# **************************************************************************** | |
# NOTES: | |
# | |
# In order for this to work, you must replace STAGING_ORGANISATION below | |
# with the name of your staging GitHub organisation, in line 53. | |
# You must also replace STAGING_SITE_REPOSITORY below with the name of your | |
# staging site repository. | |
# | |
# For example, if your staging organisation is "my-sdg-staging-org", and your | |
# staging site repository is "open-sdg-site-starter", then use: | |
# | |
# curl -X POST https://api.github.com/repos/my-sdg-staging-org/open-sdg-site-starter/dispatches | |
# | |
# **************************************************************************** | |
name: Deploy to staging | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- 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: Place public files | |
run: | | |
cp public/robots-staging.txt _site/robots.txt | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/[email protected] | |
with: | |
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: _site | |
CLEAN: true | |
- name: Waiting 4 minutes for staging data deployment | |
run: | | |
sleep 240 | |
- name: Rebuild site | |
run: | | |
curl -X POST https://api.github.com/repos/onsdigital/sdg-indicators/dispatches \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
-H "Authorization: token ${{secrets.token}}" \ | |
--data '{"event_type": "rebuild-staging"}' |