fix(deps): update dependency cypress to v13.13.3 #151
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: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: environment | |
description: "Choose an environment to deploy to" | |
required: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
NODE_VERSION: 18.x | |
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: | |
- id: var | |
run: | | |
GIT_REF=${{ github.ref }} | |
GIT_BRANCH=${GIT_REF##*/} | |
INPUT=${{ github.event.inputs.environment }} | |
ENVIRONMENT=${INPUT:-"dev"} | |
RELEASE=${ENVIRONMENT,,}-`date +%Y-%m-%d`.${{ github.run_number }} | |
NUGET_VERSION="4.7" | |
echo "environment=${ENVIRONMENT,,}" >> $GITHUB_OUTPUT | |
echo "branch=$GIT_BRANCH" >> $GITHUB_OUTPUT | |
echo "release=${RELEASE}" >> $GITHUB_OUTPUT | |
echo "nuget_version=${NUGET_VERSION}" >> $GITHUB_OUTPUT | |
tag-and-release: | |
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({ | |
draft: ${{ needs.set-env.outputs.environment == 'Dev' }}, | |
generate_release_notes: true, | |
name: "${{ needs.set-env.outputs.release }}", | |
owner: context.repo.owner, | |
prerelease: ${{ needs.set-env.outputs.environment == 'Dev' }}, | |
repo: context.repo.repo, | |
tag_name: "${{ needs.set-env.outputs.release }}", | |
}); | |
} catch (error) { | |
core.setFailed(error.message); | |
} | |
build-app: | |
name: Build app | |
needs: | |
- set-env | |
- tag-and-release | |
runs-on: windows-latest | |
environment: ${{ needs.set-env.outputs.environment }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Install Nuget | |
uses: nuget/setup-nuget@v2 | |
with: | |
nuget-version: ${{ needs.set-env.outputs.nuget_version }} | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
- name: NuGet restore | |
run: nuget restore DFE.SIP.API.SharePointOnline.sln | |
- name: Build solution | |
run: | | |
msbuild -p:Configuration=Release ` | |
-p:DeployOnBuild=true ` | |
-p:PackageAsSingleFile=false ` | |
-p:WebPublishMethod=Package ` | |
-p:SkipInvalidConfigurations=true | |
- name: Upload package | |
uses: actions/upload-artifact@master | |
with: | |
name: package | |
path: './DFE.SIP.API.SharePointOnline/obj/Release/Package/PackageTmp/' | |
retention-days: 1 | |
deploy-app: | |
name: Deploy to ${{ needs.set-env.outputs.environment }} (${{ needs.set-env.outputs.release }}) | |
needs: | |
- set-env | |
- tag-and-release | |
- build-app | |
runs-on: windows-latest | |
environment: ${{ needs.set-env.outputs.environment }} | |
steps: | |
- name: Download package | |
uses: actions/download-artifact@master | |
with: | |
name: package | |
path: './package' | |
- name: Deploy app to Azure Web Apps | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: ${{ secrets.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
package: './package' | |
cypress-tests: | |
name: Run Cypress tests | |
needs: [ set-env, build-app, deploy-app ] | |
if: needs.set-env.outputs.environment == 'test' || needs.set-env.outputs.environment == 'development' | |
uses: ./.github/workflows/cypress-tests.yml | |
with: | |
environment: ${{ needs.set-env.outputs.environment }} | |
secrets: | |
AZURE_ENDPOINT: ${{ secrets.AZURE_ENDPOINT }} |