Skip to content

Commit

Permalink
🚧Improve workflows (#238)
Browse files Browse the repository at this point in the history
* Start work for issue #236

* ci: improve sync system workflows

* ci: improve release workflow

* ci: update workflow and job names

* ci: update reusable workflow versions
  • Loading branch information
CalvinWilkinson committed Jul 12, 2023
1 parent 42c6983 commit c2877cb
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 120 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-pr-status-check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ✅Build Status Check
run-name: ✅Build Status Check
run-name: ✅Build Status Check ${{ github.base_ref == 'main' && '(Release Build)' || '(Debug Build)' }}


defaults:
Expand Down Expand Up @@ -32,9 +32,9 @@ jobs:
build_status_check:
name: Build Status Check
name: Building ${{ vars.PROJECT_NAME }}
needs: [determine_build_config]
uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v5.0.0
uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v7.2.0
with:
project-name: "${{ vars.PROJECT_NAME }}"
build-config: ${{ needs.determine_build_config.outputs.build-config }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: 🚀Preview Release
run-name: Preview Release ${{ inputs.dry-run == true && '- (Dry Run)' || '' }}
name: 🚀Release
run-name: ${{ vars.PROJECT_NAME }} ${{ inputs.release_type }} Release ${{ inputs.dry-run == true && '(Dry Run)' || '' }}


defaults:
run:
Expand All @@ -9,8 +10,15 @@ defaults:
on:
workflow_dispatch:
inputs:
release_type:
description: The type of release. Choose 'Preview' or 'Production'.
required: true
type: choice
options:
- Preview
- Production
dry-run:
description: 'Check to run the workflow without creating a release'
description: Check to run the workflow without creating a release.
required: false
default: false
type: boolean
Expand All @@ -25,24 +33,24 @@ jobs:
steps:
- name: Get Build Config
id: get-build-config
shell: pwsh
run: |
# If the branch that the workflow is running on is the required branch for the release, do a release build
if ( "${{ github.base_ref }}" -eq "preview") {
if ( "${{ github.base_ref }}" -eq "main") {
"build-config=Release" >> $env:GITHUB_OUTPUT;
Write-Host "Release build created.";
echo "Release build created.";
} else { # Any other branch than the release branch, do a debug build
"build-config=Debug" >> $env:GITHUB_OUTPUT;
Write-Host "Debug build created.";
echo "Debug build created.";
}
run_preview_release:
name: Run Preview Release
run_release:
name: Performing ${{ inputs.release_type }} Release of ${{ vars.PROJECT_NAME }} ${{ inputs.dry-run == true && '(Dry Run)' || '' }}
needs: determine_build_config
uses: KinsonDigital/Infrastructure/.github/workflows/release.yml@v6.2.1
uses: KinsonDigital/Infrastructure/.github/workflows/release.yml@v7.2.0
with:
project-name: "${{ vars.PROJECT_NAME}}"
release-type: "${{ inputs.release_type }}"
run-branch: "${{ github.ref_name }}"
net-sdk-version: "${{ vars.NET_SDK_VERSION }}"
relative-release-notes-dir-path: "${{ vars.RELATIVE_RELEASE_NOTES_DIR_PATH }}"
Expand All @@ -52,6 +60,7 @@ jobs:
pr-include-notes-label: "${{ vars.PR_INCLUDE_NOTES_LABEL }}"
send-release-tweet: ${{ vars.TWITTER_BROADCAST_ENABLED == 'true' }}
dry-run: ${{ inputs.dry-run }}
transpile-readme: true
secrets:
cicd-rest-api: "${{ secrets.CICD_REST_API }}"
nuget-org-api-key: "${{ secrets.NUGET_ORG_API_KEY }}"
Expand Down
104 changes: 0 additions & 104 deletions .github/workflows/sync-bot-status-check.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/sync-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 🤖Sync Bot


defaults:
run:
shell: pwsh


on:
issues:
types: [labeled, unlabeled, assigned, unassigned, milestoned, demilestoned]


jobs:
sync_bot:
name: Sync Bot
if: ${{ !github.event.issue.pull_request }}
runs-on: ubuntu-latest
steps:
- name: Set Up Deno
if: startsWith(github.ref_name, 'feature/')
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Run Sync Bot (Issue Change)
if: startsWith(github.ref_name, 'feature/')
run: |
$scriptUrl = "${{ vars.SCRIPT_BASE_URL }}/${{ vars.CICD_SCRIPTS_VERSION }}/${{ vars.SCRIPT_RELATIVE_DIR_PATH}}/sync-bot-status-check.ts";
$issueNumber = "${{ github.event.issue.number }}";
echo "Project Name: ${{ vars.PROJECT_NAME }}";
echo "Issue: $issueNumber";
if ($manuallyExecuted -and $issueNumber -eq "0") {
echo "The issue or PR number must be a value greater than 0.";
exit 1;
}
<# Deno Args:
1. Project Name
2. Issue Number
3. Event Type - set to issue event type
4. GitHub token
#>
deno run `
--allow-net `
"$scriptUrl" `
"${{ vars.PROJECT_NAME }}" `
"$issueNumber" `
"issue" `
"${{ secrets.CICD_REST_API }}";
51 changes: 51 additions & 0 deletions .github/workflows/sync-status-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: ✅Sync Status Check


defaults:
run:
shell: pwsh


on:
pull_request:
branches: [main, preview]


jobs:
sync_status_check:
name: Sync Status Check
if: startsWith(github.head_ref, 'feature/')
runs-on: ubuntu-latest
steps:
- name: Set Up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Run Sync Status Check
run: |
$scriptUrl = "${{ vars.SCRIPT_BASE_URL }}/${{ vars.CICD_SCRIPTS_VERSION }}/${{ vars.SCRIPT_RELATIVE_DIR_PATH}}/sync-bot-status-check.ts";
$prNumber = "${{ github.event.number }}";
echo "Project Name: ${{ vars.PROJECT_NAME }}";
echo "PR Number: $prNumber";
echo "Event Type: pr";
if ($manuallyExecuted -and $prNumber -eq "0") {
echo "The issue or PR number must be a value greater than 0.";
exit 1;
}
<# Deno Args:
1. Project Name
2. PR Number
3. Event Type - set to pull request event type
4. GitHub token
#>
deno run `
--allow-net `
"$scriptUrl" `
"${{ vars.PROJECT_NAME }}" `
"$prNumber" `
"pr" `
"${{ secrets.CICD_REST_API }}";
6 changes: 3 additions & 3 deletions .github/workflows/unit-test-pr-status-check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ✅Unit Testing Status Check
run-name: ✅Unit Testing Status Check
run-name: ✅Unit Testing Status Check ${{ github.base_ref == 'main' && '(Release Build)' || '(Debug Build)' }}


defaults:
Expand Down Expand Up @@ -32,9 +32,9 @@ jobs:
run_tests:
name: Unit Testing Status Check
name: Running ${{ vars.PROJECT_NAME }} Unit Tests
needs: determine_build_config
uses: KinsonDigital/Infrastructure/.github/workflows/run-csharp-tests.yml@v5.0.0
uses: KinsonDigital/Infrastructure/.github/workflows/run-csharp-tests.yml@v7.2.0
with:
project-name: "${{ vars.PROJECT_NAME }}Tests"
build-config: ${{ needs.determine_build_config.outputs.build-config }}
Expand Down

0 comments on commit c2877cb

Please sign in to comment.