Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/AHK.GitHub.Monitor-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy AHK.GitHub.Monitor

on:
# Trigger the workflow on a push to the main branch.
push:
branches: dev

# Allows you to run this workflow manually (for any branch) from the Actions tab.
workflow_dispatch:

env:
artifactName: buildArtifact
appNameEnvVar: "AHK_GitHub_Monitor_App_Name"
publishProfileSecret: "AHK_GitHub_Monitor_PUBLISH_PROFILE"
packageName: "Ahk.GitHub.Monitor"

jobs:
# 👇 Call the build workflow to create the artifacts to deploy, and provide the artifact name.
build:
uses: ./.github/workflows/AHK.GitHub.Monitor-build.yml
with:
artifactName: ${{ github.env.artifactName }}
secrets: inherit # Pass secrets to the build workflow, if necessary.

deploy-to-test:
needs: build
uses: ./.github/workflows/AzureFunctions-deploy.template.yml
with:
environmentName: test
artifactName: ${{ github.env.artifactName }}
packageName: ${{ github.env.packageName }}
appNameEnvVar: ${{ github.env.appNameEnvVar }}
publishProfileSecret: ${{ github.env.publishProfileSecret }}
secrets: inherit # Pass repository secrets to the deployment workflow.

deploy-to-production:
needs: deploy-to-test
uses: ./.github/workflows/AzureFunctions-deploy.template.yml
with:
environmentName: production
artifactName: ${{ github.env.artifactName }}
packageName: ${{ github.env.packageName }}
appNameEnvVar: ${{ github.env.appNameEnvVar }}
publishProfileSecret: ${{ github.env.publishProfileSecret }}
secrets: inherit # Pass repository secrets to the deployment workflow.
1 change: 0 additions & 1 deletion .github/workflows/AHK.GradeManagement-deploy.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
description: The name of the environment to deploy to.
required: true
type: string


jobs:
deploy:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/AHK.GradeManagement.QueueFunction-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build AHK.GradeManagement.QueueFunction

on:
pull_request:
branches: dev # Run workflow on PRs to the main branch.

# Run workflow on pushes to any branch, except the main branch.
# push:
# branches-ignore: dev

# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:

# 👇 Allows this workflow to be called from the deployment workflow, but the parameters must be provided.
workflow_call:
inputs:
artifactName:
description: The name of the artifact to upload to.
required: true
type: string

env:
# 👇 Provide a default artifact name for when this workflow is not called by the deployment workflow.
artifactName: ${{ inputs.artifactName || 'buildArtifact' }}

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo source code
uses: actions/checkout@v3

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: "9.0.x"

- name: "Run dotnet restore"
working-directory: src/Ahk.GradeManagement
run: dotnet restore Ahk.GradeManagement.sln

- name: "Run dotnet publish"
working-directory: src/Ahk.GradeManagement
run: dotnet publish Ahk.GradeManagement.QueueFunction/Ahk.GradeManagement.QueueFunction.csproj --no-restore --configuration Release --output '${{ github.workspace }}/output/Ahk.GradeManagement.QueueFunction'

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifactName }}
path: ./output # Put the path to the build artifact files directory here.
45 changes: 45 additions & 0 deletions .github/workflows/AHK.GradeManagement.QueueFunction-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy AHK.GradeManagement.QueueFunction

on:
# Trigger the workflow on a push to the main branch.
push:
branches: dev

# Allows you to run this workflow manually (for any branch) from the Actions tab.
workflow_dispatch:

env:
artifactName: buildArtifact
appNameEnvVar: "AHK_GradeManagement_QueueFunction_App_Name"
publishProfileSecret: "AHK_GradeManagement_QueueFunction_PUBLISH_PROFILE"
packageName: "Ahk.GradeManagement.QueueFunction"

jobs:
# 👇 Call the build workflow to create the artifacts to deploy, and provide the artifact name.
build:
uses: ./.github/workflows/AHK.GradeManagement.QueueFunction-build.yml
with:
artifactName: ${{ github.env.artifactName }}
secrets: inherit # Pass secrets to the build workflow, if necessary.

deploy-to-test:
needs: build
uses: ./.github/workflows/AzureFunctions-deploy.template.yml
with:
environmentName: test
artifactName: ${{ github.env.artifactName }}
packageName: ${{ github.env.packageName }}
appNameEnvVar: ${{ github.env.appNameEnvVar }}
publishProfileSecret: ${{ github.env.publishProfileSecret }}
secrets: inherit # Pass repository secrets to the deployment workflow.

deploy-to-production:
needs: deploy-to-test
uses: ./.github/workflows/AzureFunctions-deploy.template.yml
with:
environmentName: production
artifactName: ${{ github.env.artifactName }}
packageName: ${{ github.env.packageName }}
appNameEnvVar: ${{ github.env.appNameEnvVar }}
publishProfileSecret: ${{ github.env.publishProfileSecret }}
secrets: inherit # Pass repository secrets to the deployment workflow.
58 changes: 58 additions & 0 deletions .github/workflows/Ahk.GitHub.Monitor-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build AHK.GitHub.Monitor

on:
pull_request:
branches: dev # Run workflow on PRs to the main branch.

# Run workflow on pushes to any branch, except the main branch.
# push:
# branches-ignore: dev

# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:

# 👇 Allows this workflow to be called from the deployment workflow, but the parameters must be provided.
workflow_call:
inputs:
artifactName:
description: The name of the artifact to upload to.
required: true
type: string

env:
# 👇 Provide a default artifact name for when this workflow is not called by the deployment workflow.
artifactName: ${{ inputs.artifactName || 'buildArtifact' }}

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo source code
uses: actions/checkout@v3

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: "9.0.x"

- name: "Run dotnet restore"
working-directory: src/Ahk.GitHub.Monitor
run: dotnet restore Ahk.GitHub.Monitor.sln

- name: "Run dotnet build"
working-directory: src/Ahk.GitHub.Monitor
run: dotnet build Ahk.GitHub.Monitor.sln --no-restore --configuration Release

- name: "Run dotnet test"
working-directory: src/Ahk.GitHub.Monitor
run: dotnet test Ahk.GitHub.Monitor.sln --no-restore --no-build --configuration Release

- name: "Run dotnet publish"
working-directory: src/Ahk.GitHub.Monitor
run: dotnet publish Ahk.GitHub.Monitor/Ahk.GitHub.Monitor.csproj --no-restore --configuration Release --output '${{ github.workspace }}/output/Ahk.GitHub.Monitor'

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifactName }}
path: ./output
37 changes: 37 additions & 0 deletions .github/workflows/AzureFunctions-deploy.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy Functions TEMPLATE

on:
# Allows this workflow to be called from the deployment workflow, but the parameters must be provided.
workflow_call:
inputs:
artifactName:
description: The name of the artifact to download and deploy.
required: true
type: string
environmentName:
description: The name of the environment to deploy to.
required: true
type: string
packageName:
description: The name of the package from the artifact to deploy.
required: true
type: string

jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.environmentName }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifactName }}
path: .

- name: "Run Azure Functions deploy action using publish profile credentials"
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ vars[inputs.appName] || env[inputs.appName] }}
publish-profile: ${{ secrets[inputs.publishProfileSecret] }}
package: './${{ inputs.artifactName }}/${{ inputs.packageName }}'
Loading
Loading