From 82edbe1be344f2e7f7449937b673d18ac7a42bd6 Mon Sep 17 00:00:00 2001 From: Aabishkar KC Date: Mon, 4 Mar 2024 10:22:00 -0500 Subject: [PATCH] Add examples --- .github/workflows/greeting.yml | 20 +++++++++ .github/workflows/greeting_action.yml | 26 ++++++++++++ .github/workflows/greeting_workflow.yml | 15 +++++++ .github/workflows/msbuild.yml | 55 ++++++++++++++++++++++++ .github/workflows/msbuild_action.yml | 30 +++++++++++++ .github/workflows/msbuild_workflow.yml | 20 +++++++++ README.md | 12 ++++-- actions/README.md | 4 ++ workflows/README.md | 9 ++++ workflows/greeting.yml | 21 +--------- workflows/msbuild.yml | 56 +------------------------ 11 files changed, 189 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/greeting.yml create mode 100644 .github/workflows/greeting_action.yml create mode 100644 .github/workflows/greeting_workflow.yml create mode 100644 .github/workflows/msbuild.yml create mode 100644 .github/workflows/msbuild_action.yml create mode 100644 .github/workflows/msbuild_workflow.yml create mode 100644 actions/README.md create mode 100644 workflows/README.md mode change 100644 => 120000 workflows/greeting.yml mode change 100644 => 120000 workflows/msbuild.yml diff --git a/.github/workflows/greeting.yml b/.github/workflows/greeting.yml new file mode 100644 index 0000000..29462c4 --- /dev/null +++ b/.github/workflows/greeting.yml @@ -0,0 +1,20 @@ +name: Greeting + +on: + workflow_call: + inputs: + message: + description: Message + default: World + required: false + type: string + +jobs: + greeting: + name: Greeting + runs-on: ubuntu-latest + steps: + - name: Greeting + run: echo "Hello, $MESSAGE" + env: + MESSAGE: ${{ inputs.message }} diff --git a/.github/workflows/greeting_action.yml b/.github/workflows/greeting_action.yml new file mode 100644 index 0000000..b9ef931 --- /dev/null +++ b/.github/workflows/greeting_action.yml @@ -0,0 +1,26 @@ +name: Greeting (Action) + +on: + push: + paths: + - actions/greeting/action.yml + - .github/workflows/greeting_action.yml + workflow_dispatch: + +jobs: + greeting: + name: Greeting + runs-on: ubuntu-latest + steps: + - name: Greeting + id: greeting + uses: DynamoDS/workflows/actions/greeting@master + with: + message: World + - name: Random number + run: echo "$RANDOM_NUMBER" + shell: bash + env: + RANDOM_NUMBER: ${{ steps.greeting.outputs.number }} + - name: Date + run: date diff --git a/.github/workflows/greeting_workflow.yml b/.github/workflows/greeting_workflow.yml new file mode 100644 index 0000000..cfe6324 --- /dev/null +++ b/.github/workflows/greeting_workflow.yml @@ -0,0 +1,15 @@ +name: Greeting (Workflow) + +on: + push: + paths: + - .github/workflows/greeting.yml + - .github/workflows/greeting_workflow.yml + workflow_dispatch: + +jobs: + greeting: + name: Greeting + uses: DynamoDS/workflows/.github/workflows/greeting.yml@master + with: + message: World diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml new file mode 100644 index 0000000..212cf7e --- /dev/null +++ b/.github/workflows/msbuild.yml @@ -0,0 +1,55 @@ +name: MSBuild + +on: + workflow_call: + inputs: + runner: + description: Runner + default: windows-latest + required: false + type: string + repository: + description: Repository + required: true + type: string + dotnet_version: + description: Dotnet Version + default: 8.0.x + required: false + type: string + solution_path: + description: Solution Path + required: true + type: string + build_configuration: + description: Build Configuration + default: Release + required: false + type: string + runtime_identifier: + description: Runtime Identifier + required: false + type: string + +jobs: + build: + runs-on: ${{ inputs.runner }} + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + repository: ${{ inputs.repository }} + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ inputs.dotnet_version }} + - name: Disable problem matcher + run: Write-Output "::remove-matcher owner=csc::" + - name: Setup msbuild + uses: microsoft/setup-msbuild@v2 + - name: Restore dependencies + run: | + dotnet restore ${{ github.workspace }}\${{ inputs.solution_path }} /p:Configuration=${{ inputs.build_configuration }} --runtime=${{ inputs.runtime_identifier }} + - name: Build Solution + run: | + msbuild ${{ github.workspace }}\${{ inputs.solution_path }} /p:Configuration=${{ inputs.build_configuration }} diff --git a/.github/workflows/msbuild_action.yml b/.github/workflows/msbuild_action.yml new file mode 100644 index 0000000..c721b70 --- /dev/null +++ b/.github/workflows/msbuild_action.yml @@ -0,0 +1,30 @@ +name: MSBuild (Action) + +on: + push: + paths: + - actions/msbuild/action.yml + - .github/workflows/msbuild_action.yml + workflow_dispatch: + +jobs: + msbuild: + name: MSBuild + runs-on: windows-latest + steps: + - name: MSBuild + uses: DynamoDS/workflows/actions/msbuild@master + with: + repository: DynamoDS/Dynamo + dotnet_version: 8.0.x + solution_path: src\Dynamo.All.sln + build_configuration: Release + runtime_identifier: win-x64 + - name: Look for DynamoCLI.exe + run: | + Write-Output "***Locating DynamoCLI.exe!***" + if (Test-Path -Path "${{ github.workspace }}/bin/AnyCPU/Release/DynamoCLI.exe") { + Write-Output "DynamoCLI.exe exists!" + } else { + Write-Error "DynamoCLI.exe was not found!" + } diff --git a/.github/workflows/msbuild_workflow.yml b/.github/workflows/msbuild_workflow.yml new file mode 100644 index 0000000..bc24e54 --- /dev/null +++ b/.github/workflows/msbuild_workflow.yml @@ -0,0 +1,20 @@ +name: MSBuild (Workflow) + +on: + push: + paths: + - .github/workflows/msbuild.yml + - .github/workflows/msbuild_workflow.yml + workflow_dispatch: + +jobs: + msbuild: + name: MSBuild + uses: DynamoDS/workflows/.github/workflows/msbuild.yml@master + with: + runner: windows-latest + repository: DynamoDS/Dynamo + dotnet_version: 8.0.x + solution_path: src\Dynamo.All.sln + build_configuration: Release + runtime_identifier: win-x64 diff --git a/README.md b/README.md index 56aaf2a..632b078 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,17 @@ Collection of reusable workflows and compostite actions ## Reusable Workflows -- [greeting.yml](workflows/greeting.yml) -- [msbuild.yml](workflows/msbuild.yml) +| workflow | description | example workflow | status | +| -- | -- | -- | -- | +| [greeting.yml](https://github.com/DynamoDS/workflows/blob/master/workflows/greeting.yml) | sample workflow | [greeting_workflow.yml](.github/workflows/greeting_workflow.yml) | [![Greeting (Workflow)](https://github.com/DynamoDS/workflows/actions/workflows/greeting_workflow.yml/badge.svg)](https://github.com/DynamoDS/workflows/actions/workflows/greeting_workflow.yml) | +| [msbuild.yml](https://github.com/DynamoDS/workflows/blob/master/workflows/msbuild.yml) | Build a project with msbuild | [msbuild_workflow.yml](.github/workflows/msbuild_workflow.yml) | [![MSBuild (Workflow)](https://github.com/DynamoDS/workflows/actions/workflows/msbuild_workflow.yml/badge.svg)](https://github.com/DynamoDS/workflows/actions/workflows/msbuild_workflow.yml) | ## Composite Actions -- [greeting](actions/greeting/action.yml) -- [msbuild](actions/msbuild/action.yml) +| action | description | example workflow | status | +| -- | -- | -- | -- | +| [greeting.yml](https://github.com/DynamoDS/workflows/blob/master/.github/actions/greetion/action.yml) | sample workflow | [greeting_action.yml](.github/workflows/greeting_actions.yml) | [![Greeting (Action)](https://github.com/DynamoDS/workflows/actions/workflows/greeting_action.yml/badge.svg)](https://github.com/DynamoDS/workflows/actions/workflows/greeting_action.yml) | +| [msbuild.yml](https://github.com/DynamoDS/workflows/blob/master/.github/actions/msbuild/action.yml) | Build a project with msbuild | [msbuild_action.yml](.github/workflows/msbuild_action.yml) | [![MSBuild (Action)](https://github.com/DynamoDS/workflows/actions/workflows/msbuild_action.yml/badge.svg)](https://github.com/DynamoDS/workflows/actions/workflows/msbuild_action.yml) | More info: diff --git a/actions/README.md b/actions/README.md new file mode 100644 index 0000000..a92bb33 --- /dev/null +++ b/actions/README.md @@ -0,0 +1,4 @@ +# Composite Actions + +- [greeting](./greeting) +- [msbuild](./msbuild) diff --git a/workflows/README.md b/workflows/README.md new file mode 100644 index 0000000..2a6046e --- /dev/null +++ b/workflows/README.md @@ -0,0 +1,9 @@ +# Reusable Workflows + +> [!IMPORTANT] +> Reusable Workflow files must be placed in .github/workflows folder. See: [Calling a reusable workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow) + +Files here are symlinks to the files in [.github/workflows](./.github/workflows) folder + +- [greeting](greeting.yml) +- [msbuild](msbuild.yml) diff --git a/workflows/greeting.yml b/workflows/greeting.yml deleted file mode 100644 index 29462c4..0000000 --- a/workflows/greeting.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Greeting - -on: - workflow_call: - inputs: - message: - description: Message - default: World - required: false - type: string - -jobs: - greeting: - name: Greeting - runs-on: ubuntu-latest - steps: - - name: Greeting - run: echo "Hello, $MESSAGE" - env: - MESSAGE: ${{ inputs.message }} diff --git a/workflows/greeting.yml b/workflows/greeting.yml new file mode 120000 index 0000000..75fa631 --- /dev/null +++ b/workflows/greeting.yml @@ -0,0 +1 @@ +../.github/workflows/greeting.yml \ No newline at end of file diff --git a/workflows/msbuild.yml b/workflows/msbuild.yml deleted file mode 100644 index 212cf7e..0000000 --- a/workflows/msbuild.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: MSBuild - -on: - workflow_call: - inputs: - runner: - description: Runner - default: windows-latest - required: false - type: string - repository: - description: Repository - required: true - type: string - dotnet_version: - description: Dotnet Version - default: 8.0.x - required: false - type: string - solution_path: - description: Solution Path - required: true - type: string - build_configuration: - description: Build Configuration - default: Release - required: false - type: string - runtime_identifier: - description: Runtime Identifier - required: false - type: string - -jobs: - build: - runs-on: ${{ inputs.runner }} - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - repository: ${{ inputs.repository }} - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: ${{ inputs.dotnet_version }} - - name: Disable problem matcher - run: Write-Output "::remove-matcher owner=csc::" - - name: Setup msbuild - uses: microsoft/setup-msbuild@v2 - - name: Restore dependencies - run: | - dotnet restore ${{ github.workspace }}\${{ inputs.solution_path }} /p:Configuration=${{ inputs.build_configuration }} --runtime=${{ inputs.runtime_identifier }} - - name: Build Solution - run: | - msbuild ${{ github.workspace }}\${{ inputs.solution_path }} /p:Configuration=${{ inputs.build_configuration }} diff --git a/workflows/msbuild.yml b/workflows/msbuild.yml new file mode 120000 index 0000000..2d74cbe --- /dev/null +++ b/workflows/msbuild.yml @@ -0,0 +1 @@ +../.github/workflows/msbuild.yml \ No newline at end of file