Skip to content

Workflow file for this run

on:
# Triggers the workflow on push or pull request events but only for the main branch
workflow_call:
inputs:
app_name:
required: false
type: string
environment:
required: true
type: string
run_db_migrations:
required: false
default: false
type: boolean
image_location:
description: "Location of the image to deploy."
type: string
required: false
notify_slack:
required: true
default: false
type: boolean
secrets:
AWS_ACCOUNT:
required: true
SLACK_BOT_TOKEN:
required: false
SLACK_NOTIFICATION_CHANNEL_ID:
required: false
jobs:
deploy:
if: ${{ github.actor != 'dependabot[bot]' }}
concurrency:
group: 'fsd-preaward-${{ inputs.environment }}'
cancel-in-progress: false
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Git clone the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get current date
shell: bash
id: currentdatetime
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/GithubCopilotDeploy
role-session-name: "${{ inputs.app_name }}_${{ inputs.environemnt }}_copilot_${{ steps.currentdatetime.outputs.datetime }}"
aws-region: eu-west-2
- name: Install AWS Copilot CLI
shell: bash
run: |
curl -Lo aws-copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && chmod +x aws-copilot && sudo mv aws-copilot /usr/local/bin/copilot
- name: confirm copilot env
shell: bash
run: |
if [ $(copilot env ls) != "${{ inputs.environment }}" ]; then
echo $(copilot env ls)
exit 1
fi
- name: Inject Git SHA into manifest
run: |
yq -i '.variables.GITHUB_SHA = "${{ github.sha }}"' copilot/fsd-${{ inputs.app_name }}/manifest.yml
- name: Inject replacement image into manifest
run: |
yq -i ".image.location = \"${{ inputs.image_location }}\"" copilot/fsd-${{ inputs.app_name }}/manifest.yml
- name: Slack message for start of deployment
id: slack_start_deployment_message
# if: ${{ (inputs.environment == 'prod' || inputs.environment == 'production') }}
uses: communitiesuk/funding-service-design-workflows/.github/actions/slack_deployment_start@bau/slack-notify-deployments
with:
environment: ${{ inputs.environment }}
workflow_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
compare_url: ${{ github.event_name == 'push' && github.event.compare || 'https://httpstat.us/404' }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ secrets.SLACK_NOTIFICATION_CHANNEL_ID }}
- name: Run database migrations
id: db_migrations
if: ${{ inputs.run_db_migrations }}
run: echo hi
- name: Copilot ${{ inputs.environment }} deploy
id: deploy_build
run: echo hi
- name: Slack message for end of deployment
# if: ${{ (inputs.environment == 'prod' || inputs.environment == 'production') }}
uses: communitiesuk/funding-service-design-workflows/.github/actions/slack_deployment_end@bau/slack-notify-deployments
with:
environment: ${{ inputs.environment }}
workflow_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
compare_url: ${{ github.event_name == 'push' && github.event.compare || 'https://httpstat.us/404' }}
status: ${{ ( (steps.db_migrations.outcome == 'skipped' || steps.db_migrations.outcome == 'success') && steps.deploy_build.outcome == 'success') && ':white_check_mark: Succeeded' || ':x: Failed' }}

Check failure on line 105 in .github/workflows/standard-deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/standard-deploy.yml

Invalid workflow file

You have an error in your yaml syntax on line 105
start_ts: ${{ steps.slack_start_deployment_message.outputs.timestamp }}
slack_thread_id: ${{ steps.slack_start_deployment_message.outputs.slack_ts }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ secrets.SLACK_NOTIFICATION_CHANNEL_ID }}
notify_slack:
needs:
- deploy
if: ${{ inputs.notify_slack && always() && needs.deploy.result == 'failure' }}
uses: ./.github/workflows/notify-slack-deployment-failed.yml
with:
app_name: ${{ inputs.app_name }}
env_name: ${{ inputs.environment }}
github_username: ${{ github.actor }}
workflow_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
compare_url: ${{ github.event_name == 'push' && github.event.compare || null }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_NOTIFICATION_CHANNEL_ID: ${{ secrets.SLACK_NOTIFICATION_CHANNEL_ID }}