Skip to content

Commit

Permalink
Add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
avidit committed Mar 4, 2024
1 parent 6faddc0 commit b562af3
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 79 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/greeting.yml
Original file line number Diff line number Diff line change
@@ -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 }}
26 changes: 26 additions & 0 deletions .github/workflows/greeting_action.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions .github/workflows/greeting_workflow.yml
Original file line number Diff line number Diff line change
@@ -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
55 changes: 55 additions & 0 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
@@ -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 }}
30 changes: 30 additions & 0 deletions .github/workflows/msbuild_action.yml
Original file line number Diff line number Diff line change
@@ -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!"
}
20 changes: 20 additions & 0 deletions .github/workflows/msbuild_workflow.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 4 additions & 0 deletions actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Composite Actions

- [greeting](./greeting)
- [msBuild](./msbuild)
9 changes: 9 additions & 0 deletions workflows/README.md
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 0 additions & 20 deletions workflows/greeting.yml

This file was deleted.

1 change: 1 addition & 0 deletions workflows/greeting.yml
55 changes: 0 additions & 55 deletions workflows/msbuild.yml

This file was deleted.

1 change: 1 addition & 0 deletions workflows/msbuild.yml

0 comments on commit b562af3

Please sign in to comment.