Skip to content

Deploy

Deploy #7343

Workflow file for this run

name: Deploy
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
permissions:
contents: write
steps:
- name: Set commit message up front
id: commit_message_writer
run: | # `github.event.number` will be blank if this is a cron
if [ "${{ github.event.number }}" == "" ]; then
echo "commit_message=Hourly scheduled redeploy" >> "$GITHUB_OUTPUT"
else
echo "commit_message=Deploy via merge" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: false
- name: Clone publishing api
uses: actions/checkout@v4
with:
repository: alphagov/publishing-api
ref: main
path: tmp/publishing-api
show-progress: false
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v4
with:
cache: 'npm'
- run: yarn install --frozen-lockfile
- name: Build 'build' folder ready for deployment
run: bundle exec rake build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOVUK_CONTENT_SCHEMAS_PATH: tmp/publishing-api/content_schemas
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
cname: docs.publishing.service.gov.uk
commit_message: ${{steps.commit_message_writer.outputs.commit_message}}
force_orphan: true
- name: Notify failure
if: ${{ failure() }}
uses: alphagov/govuk-infrastructure/.github/actions/report-run-failure@main
with:
slack_webhook_url: ${{ secrets.GOVUK_SLACK_WEBHOOK_URL }}
channel: govuk-deploy-alerts
message: "The <https://github.com/alphagov/govuk-developer-docs/blob/main/.github/workflows/deploy.yml|Developer Docs deployment script> failed."