Skip to content

Bump dependabot/fetch-metadata from 2.4.0 to 2.5.0 #92

Bump dependabot/fetch-metadata from 2.4.0 to 2.5.0

Bump dependabot/fetch-metadata from 2.4.0 to 2.5.0 #92

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: read
outputs:
version: ${{ steps.set-version-number.outputs.version }}
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
source-url: https://nuget.pkg.github.com/AndrewMcLachlan/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.CROSS_REPO_PACKAGE_TOKEN}}
- name: Set version number
id: set-version-number
uses: andrewmclachlan/actions/set-version-number@v4
with:
project: 'src/KeyLens.Api'
version-property-name: 'Version'
- name: Restore dependencies
run: dotnet restore KeyLens.slnx
- name: Setup node and npm
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: 'src/KeyLens.App/package-lock.json'
registry-url: "https://npm.pkg.github.com"
- name: Publish
run: dotnet publish src/KeyLens.Api/KeyLens.Api.csproj --output ${{ github.workspace }}/publish --configuration Release --p:Version=${{ steps.set-version-number.outputs.version }} --p:FileVersion=${{ steps.set-version-number.outputs.version }} --no-restore
- name: Install App dependencies
env:
NODE_AUTH_TOKEN: ${{ secrets.CROSS_REPO_PACKAGE_TOKEN }}
run: npm ci --prefix src/KeyLens.App --force
- name: Version App
run: npm version ${{ steps.set-version-number.outputs.version }} --prefix src/KeyLens.App --force
- name: Build App
run: npm run build --prefix src/KeyLens.App
- name: Copy App
run: cp -r src/KeyLens.App/dist ${{ github.workspace }}/publish/wwwroot
- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: publish
path: ${{ github.workspace }}/publish
- name: Build Docker image (validation only)
uses: docker/build-push-action@v6
with:
context: .
file: ./src/KeyLens.Api/Dockerfile
push: false
tags: |
ghcr.io/andrewmclachlan/keylens:${{steps.set-version-number.outputs.version}}
ghcr.io/andrewmclachlan/keylens:latest
docker-push:
runs-on: ubuntu-latest
needs: build
if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main')
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v6
- name: Download publish artifact
uses: actions/download-artifact@v7
with:
name: publish
path: ${{ github.workspace }}/publish
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./src/KeyLens.Api/Dockerfile
push: true
tags: |
ghcr.io/andrewmclachlan/keylens:${{needs.build.outputs.version}}
ghcr.io/andrewmclachlan/keylens:latest
cache-from: type=registry,ref=ghcr.io/andrewmclachlan/keylens:latest
cache-to: type=inline
staging:
concurrency:
group: keylens-deploy-group
cancel-in-progress: true
needs: [build, docker-push]
if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main')
uses: AndrewMcLachlan/actions/.github/workflows/deploy-azure.yml@v4
with:
environment: Staging
artifact-name: publish
app-name: keylens
resource-group: KeyLens
slot-name: staging
container-image: ghcr.io/andrewmclachlan/keylens:${{needs.build.outputs.version}}
container-name: main
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
production:
concurrency:
group: keylens-deploy-group
cancel-in-progress: true
needs: staging
if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main')
uses: AndrewMcLachlan/actions/.github/workflows/azure-appservice-swap-slot.yml@v4
with:
environment: Production
app-name: keylens
resource-group: KeyLens
slot-name: staging
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
post-production:
concurrency:
group: keylens-deploy-group
cancel-in-progress: true
needs: [build, production]
if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main')
uses: AndrewMcLachlan/actions/.github/workflows/deploy-azure.yml@v4
with:
environment: Post-Production
artifact-name: publish
app-name: keylens
resource-group: KeyLens
slot-name: staging
container-image: ghcr.io/andrewmclachlan/keylens:${{needs.build.outputs.version}}
container-name: main
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}