Update dependency standard to v17.1.2 #4221
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: Deploy to environment | |
on: | |
pull_request: | |
branches: [ main, '**-feature' ] | |
types: [ opened, synchronize, reopened] | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: environment | |
description: "Choose an environment to deploy to" | |
required: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.inputs.environment }} | |
jobs: | |
set-env: | |
name: Determine environment | |
runs-on: ubuntu-22.04 | |
outputs: | |
environment: ${{ steps.var.outputs.environment }} | |
branch: ${{ steps.var.outputs.branch }} | |
release: ${{steps.var.outputs.release}} | |
steps: | |
- if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
name: Get branch name for push/dispatch event | |
run: | | |
GIT_REF=${{ github.ref_name }} | |
echo "branch_ref=${GIT_REF}" >> $GITHUB_ENV | |
- if: github.event_name == 'pull_request' | |
name: Get source branch for pull request | |
run: | | |
GIT_REF=${{ github.head_ref }} | |
echo "branch_ref=${GIT_REF}" >> $GITHUB_ENV | |
- id: var | |
run: | | |
GIT_REF=${{ env.branch_ref }} | |
GIT_BRANCH=${GIT_REF##*/} | |
INPUT=${{ github.event.inputs.environment }} | |
ENVIRONMENT=${INPUT:-"development"} | |
RELEASE=${ENVIRONMENT,,}-`date +%Y-%m-%d`.${{ github.run_number }} | |
echo "environment=${ENVIRONMENT,,}" >> $GITHUB_OUTPUT | |
echo "branch=$GIT_BRANCH" >> $GITHUB_OUTPUT | |
echo "release=${RELEASE,,}" >> $GITHUB_OUTPUT | |
create-tag: | |
if: needs.set-env.outputs.environment == 'production' | |
name: Tag and release | |
needs: set-env | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Create tag | |
run: | | |
git tag ${{ needs.set-env.outputs.release }} | |
git push origin ${{ needs.set-env.outputs.release }} | |
- name: Create release | |
uses: "actions/github-script@v7" | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
try { | |
await github.rest.repos.createRelease({ | |
generate_release_notes: true, | |
name: "${{ needs.set-env.outputs.release }}", | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: "${{ needs.set-env.outputs.release }}", | |
}); | |
} catch (error) { | |
core.setFailed(error.message); | |
} | |
deploy-image: | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
name: Deploy to environment | |
needs: [ set-env ] | |
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/[email protected] | |
with: | |
docker-image-name: 'fiat-app' | |
docker-build-file-name: 'docker/Dockerfile' | |
environment: ${{ needs.set-env.outputs.environment }} | |
annotate-release: true | |
secrets: | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
azure-acr-client-id: ${{ secrets.ACR_CLIENT_ID }} | |
azure-acr-name: ${{ secrets.ACR_NAME }} | |
azure-aca-client-id: ${{ secrets.ACA_CLIENT_ID }} | |
azure-aca-name: ${{ secrets.ACA_CONTAINERAPP_NAME }} | |
azure-aca-resource-group: ${{ secrets.ACA_RESOURCE_GROUP }} | |
run-automated-ui-tests: | |
name: Run automated UI tests | |
uses: ./.github/workflows/test-automated-ui.yml | |
needs: [ deploy-image, set-env ] | |
if: ${{ needs.set-env.outputs.environment == 'development' }} | |
with: | |
environment: ${{ needs.set-env.outputs.environment }} | |
branch-name: ${{ needs.set-env.outputs.branch }} | |
secrets: inherit |