Build datasets and publish #73
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: Build datasets and publish | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
schedule: | |
- cron: "0 8 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo content | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Create dotenv | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
run: | | |
echo "HF_TOKEN=$HF_TOKEN" >> .env | |
- name: Run tests and try and build project | |
uses: mysociety/run-in-devcontainer@v1 | |
with: | |
run: | | |
export PATH="/root/.local/bin:$PATH" | |
notebook render search --publish | |
- name: Push new data | |
id: auto-commit-action | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Update repo data based on source changes" | |
- name: Send GitHub Action trigger data to Slack workflow | |
id: slack | |
if: steps.auto-commit-action.outputs.changes_detected == 'true' | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"repo_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.HAPPY_DATABOT_SLACK_WEBHOOK }} | |
- name: Setup Pages | |
uses: actions/configure-pages@v1 | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
with: | |
source: docs | |
destination: docs/_site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: docs/_site | |
- name: Send GitHub Action trigger data to Slack workflow (if failed) | |
if: ${{ failure() }} | |
id: slack-failed | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"repo_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SAD_DATABOT_SLACK_WEBHOOK }} | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
- uses: geekyeggo/delete-artifact@v1 | |
with: | |
name: github-pages |