Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CARE-265: Refactoring GitHub Actions workflows to DRY with common ones #30

Merged
merged 12 commits into from
Nov 25, 2022
31 changes: 10 additions & 21 deletions .github/actions/build-vsix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,24 @@ runs:
steps:
- name: Set VSIX version
id: vsix-version
# This PR: https://github.com/timheuer/vsix-version-stamp/pull/4.
uses: timheuer/vsix-version-stamp@d9f75864ba373a0ae6e9402ecb1da44cf2c1dfa6
# Latest code as of 17.11.2022.
uses: timheuer/vsix-version-stamp@9d38292e99e54046455bb68c6a2b5113d269a7d0
with:
manifest-file: Lombiq.Vsix.Orchard\source.extension.vsixmanifest
vsix-token-source-file: Lombiq.Vsix.Orchard\Constants\ExtensionVersion.cs
version-number: ${{ inputs.version-number }}

- name: Add MSBuild to PATH
# v1.1.3
uses: microsoft/setup-msbuild@34cfbaee7f672c76950673338facd8a73f637506
with:
vs-version: "[17.3,]"

- name: Build
- name: Configure Output Directory
id: output-directory
shell: pwsh
run: |
$buildSwitches = @(
'-verbosity:minimal'
'-restore'
'-property:Configuration=Release'
'-property:RunAnalyzersDuringBuild=true'
'-property:TreatWarningsAsErrors=true'
'-warnaserror'
'-property:Retries=4'
'-property:RetryDelayMilliseconds=1000'
"-property:OutDir=$(Join-Path $PWD artifacts)"
)
"directory=$(Join-Path $PWD artifacts)" >> $Env:GITHUB_OUTPUT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this entry needed in $Env:GITHUB_OUTPUT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is creating an output of the step, which is then used in the Build step. Since this value need so be produced in PS (or some other script), as opposed to simply using one of the GHA expressions (in which case it would be embedded in the assignment to dotnet-build-switches), we need a separate step to run this script.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I see now that directory is used in the following step.


msbuild @buildSwitches
- name: Build
uses: Lombiq/GitHub-Actions/.github/actions/msbuild@issue/CARE-265
with:
msbuild-switches: |
"-property:OutDir=${{ steps.output-directory.outputs.directory }}"

- name: Upload Artifact
uses: actions/upload-artifact@v3
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ jobs:
runs-on: windows-latest
timeout-minutes: 10
steps:
- uses: actions/[email protected]
with:
submodules: recursive
- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/CARE-265

- name: Build VSIX
uses: ./.github/actions/build-vsix
5 changes: 2 additions & 3 deletions .github/workflows/publish-marketplace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/[email protected]
with:
submodules: recursive
- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@issue/CARE-265

- name: Set Version
id: set-version
Expand Down