Skip to content

test update

test update #66

Workflow file for this run

name: cicd
on:
push:
branches: ["v2"]
paths:
- "api/**"
- "apps/blazor/**"
pull_request:
branches: ["v2"]
paths:
- "api/**"
- "apps/blazor/**"
jobs:
check-api-changes:
runs-on: ubuntu-latest
steps:
- name: Check for API changes
id: check_api
run: |
if git diff --name-only HEAD...origin/v2 | grep -q '^api/'; then
echo "api_changed=true" >> $GITHUB_ENV
else
echo "api_changed=false" >> $GITHUB_ENV
fi
build-api:
needs: check-api-changes
if: env.api_changed == 'true'

Check failure on line 30 in .github/workflows/cicd.yml

View workflow run for this annotation

GitHub Actions / cicd

Invalid workflow file

The workflow is not valid. .github/workflows/cicd.yml (Line: 30, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.api_changed == 'true' .github/workflows/cicd.yml (Line: 47, Col: 9): Unrecognized named-value: 'env'. Located at position 32 within expression: github.event_name == 'push' && env.api_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
- name: Restore dependencies
run: dotnet restore ./api/FSH.WebApi.sln
- name: Build
run: dotnet build ./api/FSH.WebApi.sln --no-restore
- name: Test
run: dotnet test ./api/FSH.WebApi.sln --no-build --verbosity normal
publish-api:
needs: check-api-changes
if: github.event_name == 'push' && env.api_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to GitHub Container Registry
working-directory: ./api/
run: |
dotnet publish -c Release -p:ContainerRepository=ghcr.io/${{ github.repository_owner }}/webapi -p:RuntimeIdentifier=linux-x64
docker push ghcr.io/${{ github.repository_owner }}/webapi --all-tags
check-blazor-changes:
runs-on: ubuntu-latest
steps:
- name: Check for Blazor changes
id: check_blazor
run: |
if git diff --name-only HEAD...origin/v2 | grep -q '^apps/blazor/'; then
echo "blazor_changed=true" >> $GITHUB_ENV
else
echo "blazor_changed=false" >> $GITHUB_ENV
fi
build-blazor:
needs: check-blazor-changes
if: env.blazor_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
- name: Restore dependencies
run: dotnet restore ./apps/blazor/FSH.Blazor.sln
- name: Build
run: dotnet build ./apps/blazor/FSH.Blazor.sln --no-restore
- name: Test
run: dotnet test ./apps/blazor/FSH.Blazor.sln --no-build --verbosity normal
publish-blazor:
needs: check-blazor-changes
if: github.event_name == 'push' && env.blazor_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to GitHub Container Registry
working-directory: ./apps/blazor/
run: |
dotnet publish -c Release -p:ContainerRepository=ghcr.io/${{ github.repository_owner }}/blazor -p:RuntimeIdentifier=linux-x64
docker push ghcr.io/${{ github.repository_owner }}/blazor --all-tags