Skip to content

Feature/codeowners

Feature/codeowners #1

Workflow file for this run

name: .NET CI-CD
env:
registryName: ${{ secrets.CONTAINER_REGISTRY_NAME }}.azurecr.io
repositoryName: techexcel/dotnetcoreapp
dockerFolderPath: ./src/Application/src/RazorPagesTestSample
tag: ${{github.run_number}}
on:
push:
branches: [ main ]
paths: src/Application/**
pull_request:
branches: [ main ]
paths: src/Application/**
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0
- name: Restore dependencies
run: dotnet restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
- name: Build
run: dotnet build --no-restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
- name: Test
run: dotnet test --no-build --verbosity normal ./src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
- uses: actions/github-script@v6
if: failure()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
let body = "${{ env.build_name }} Workflow Failure \n Build Number: ${{ github.run_number }} \n Build Log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \n SHA: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) \n";
github.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "${{ env.build_name }} Workflow ${{ github.run_number }} Failed! ",
body: body
});
dockerBuildPush:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Docker Login
# You may pin to the exact commit or the version.
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/[email protected]
with:
# Server address of Docker registry. If not set then will default to Docker Hub
registry: ${{ secrets.ACR_LOGIN_SERVER }}
# Username used to log against the Docker registry
username: ${{ secrets.ACR_USERNAME }}
# Password or personal access token used to log against the Docker registry
password: ${{ secrets.ACR_PASSWORD }}
# Log out from the Docker registry at the end of a job
logout: true
- name: Docker Build
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath
- name: Docker Push
run: docker push $registryName/$repositoryName:$tag
deploy:

Check failure on line 76 in .github/workflows/ci-cd.yml

View workflow run for this annotation

GitHub Actions / .NET CI-CD

Invalid workflow file

The workflow is not valid. .github/workflows/ci-cd.yml (Line: 76, Col: 3): Error calling workflow 'microsoft/TechExcel-Accelerate-developer-productivity-with-GitHub-Copilot-and-Dev-Box/.github/workflows/reusable-cd.yml@cbc58b2f46f781d73e4d78ff84e44e2ae6d1c662'. The nested job 'deploy' is requesting 'pages: write, id-token: write', but is only allowed 'pages: none, id-token: none'.
needs: dockerBuildPush
uses: ./.github/workflows/reusable-cd.yml
with:
environment: dev
secrets: inherit
# deploy-to-test:
# runs-on: ubuntu-latest
# needs: deploy-to-dev
# environment:
# name: test
# url: https://{your_prefix}-test.azurewebsites.net/
# steps:
# - uses: actions/checkout@v3
# - name: 'Login via Azure CLI'
# uses: azure/[email protected]
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}
# - uses: azure/webapps-deploy@v2
# with:
# app-name: '{your_prefix}-test'
# images: {your_registry_name}.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
# deploy-to-prod:
# runs-on: ubuntu-latest
# needs: deploy-to-test
# environment:
# name: prod
# url: https://{your_prefix}-prod.azurewebsites.net/
# steps:
# - uses: actions/checkout@v3
# - name: 'Login via Azure CLI'
# uses: azure/[email protected]
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}
# - uses: azure/webapps-deploy@v2
# with:
# app-name: '{your_prefix}-prod'
# images: {your_registry_name}.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}