Skip to content

Commit

Permalink
Merge pull request #28 from alphagov/sengi/new-wfs
Browse files Browse the repository at this point in the history
Replace old build workflow with new release/deploy ones.
  • Loading branch information
theseanything authored May 21, 2024
2 parents f222731 + 900835f commit 28aba07
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 24 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/build.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy

run-name: Deploy ${{ inputs.gitRef || github.event.release.tag_name }} to ${{ inputs.environment || 'integration' }}

on:
workflow_dispatch:
inputs:
gitRef:
description: 'Commit, tag or branch name to deploy'
required: true
type: string
environment:
description: 'Environment to deploy to'
required: true
type: choice
options:
- integration
- staging
- production
default: 'integration'
release:
types: [released]

jobs:
build-and-publish-image:
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'v')
name: Build and publish image
uses: alphagov/govuk-infrastructure/.github/workflows/build-and-push-multiarch-image.yml@main
with:
gitRef: ${{ inputs.gitRef || github.event.release.tag_name }}
permissions:
id-token: write
contents: read
trigger-deploy:
name: Trigger deploy to ${{ inputs.environment || 'integration' }}
needs: build-and-publish-image
uses: alphagov/govuk-infrastructure/.github/workflows/deploy.yml@main
with:
imageTag: ${{ needs.build-and-publish-image.outputs.imageTag }}
environment: ${{ inputs.environment || 'integration' }}
secrets:
WEBHOOK_TOKEN: ${{ secrets.GOVUK_ARGO_EVENTS_WEBHOOK_TOKEN }}
WEBHOOK_URL: ${{ secrets.GOVUK_ARGO_EVENTS_WEBHOOK_URL }}
GH_TOKEN: ${{ secrets.GOVUK_CI_GITHUB_API_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release

on:
workflow_dispatch:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]

jobs:
release:
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
name: Release
uses: alphagov/govuk-infrastructure/.github/workflows/release.yml@main
secrets:
GH_TOKEN: ${{ secrets.GOVUK_CI_GITHUB_API_TOKEN }}

0 comments on commit 28aba07

Please sign in to comment.