Skip to content

Commit

Permalink
[Dependencies] - Update .github/actions/build/action.yml to match the…
Browse files Browse the repository at this point in the history
… template repo
  • Loading branch information
credfeto committed Oct 26, 2023
1 parent 0553c6c commit 9bcc938
Showing 1 changed file with 54 additions and 21 deletions.
75 changes: 54 additions & 21 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ runs:
[[ (${{steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true'}}) || steps.check_files.outputs.NPM_EXIST == 'true' ]] && echo 'BUILD_ENV=true' >> "$GITHUB_OUTPUT" || echo 'BUILD_ENV=false' >> "$GITHUB_OUTPUT"
[[ (${{steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true'}}) || steps.check_files.outputs.NPM_EXIST == 'true' ]] && echo 'BUILD_ENV=true' >> "$GITHUB_OUTPUT" || echo 'BUILD_ENV=false' >> "$GITHUB_OUTPUT"
- if: ${{steps.build_tools.outputs.BUILD_ENV == 'true' && inputs.NUGET_PACK == 'true'}}
- if: |-
steps.build_tools.outputs.BUILD_ENV == 'true' &&
inputs.NUGET_PACK == 'true'
name: "Install Multi-Push Tool"
shell: bash
run: dotnet tool install --local Credfeto.Package.Push
Expand All @@ -184,14 +186,14 @@ runs:
DOTNET_TieredPGO: "1"
- name: "Get Unique Build Number"
if: ${{steps.build_tools.outputs.BUILD_ENV == 'true'}}
if: steps.build_tools.outputs.BUILD_ENV == 'true'
uses: onyxmueller/build-tag-number@v1
id: build-number
with:
token: ${{inputs.GITHUB_TOKEN}}
prefix: github

- if: ${{steps.build_tools.outputs.BUILD_ENV == 'true'}}
- if: steps.build_tools.outputs.BUILD_ENV == 'true'
name: "Set Define Build Version"
shell: bash
run: dotnet buildversion --BuildNumber "${{steps.build-number.outputs.build_number}}"
Expand All @@ -211,25 +213,25 @@ runs:
{ echo "DEPLOY=false"; } >> "$GITHUB_ENV"
- name: "Deploy check - Is main or master"
if: ${{endsWith(env.BUILD_VERSION, '-main') || endsWith(env.BUILD_VERSION, '-master')}}
if: endsWith(env.BUILD_VERSION, '-main') || endsWith(env.BUILD_VERSION, '-master')
shell: bash
run: |
{ echo "DEPLOY=true"; echo "RELEASE=false"; } >> "$GITHUB_ENV"
- name: Deploy check - Is release branch
if: ${{!contains(env.BUILD_VERSION, '-')}}
if: contains(env.BUILD_VERSION, '-') == false
shell: bash
run: |
{ echo "DEPLOY=true"; echo "RELEASE=true"; } >> "$GITHUB_ENV"
- name: "Deploy check - Is Dependabot"
if: ${{(github.actor == 'dependabot[bot]')}}
if: (github.actor == 'dependabot[bot]')
shell: bash
run: |
{ echo "DEPLOY=false"; } >> "$GITHUB_ENV"
- name: "Install Package Builder"
if: ${{steps.check_files.outputs.NPM_EXIST == 'true' && steps.check_files.outputs.NPM_SIGNING_EXIST == 'true' }}
if: steps.check_files.outputs.NPM_EXIST == 'true' && steps.check_files.outputs.NPM_SIGNING_EXIST == 'true'
shell: bash
run: dotnet tool install --local FunFair.Content.Packager.Cmd --version ${{inputs.NPM_PRODUCTION_PACKAGER_VERSION}}
env:
Expand All @@ -243,7 +245,7 @@ runs:
DOTNET_TieredPGO: "1"

- name: "Install Package Store Signer"
if: ${{steps.check_files.outputs.NPM_EXIST == 'true' && steps.check_files.outputs.NPM_SIGNING_EXIST == 'true' }}
if: steps.check_files.outputs.NPM_EXIST == 'true' && steps.check_files.outputs.NPM_SIGNING_EXIST == 'true'
shell: bash
run: dotnet tool install --local FunFair.Content.PackageSigner.Cmd --version ${{inputs.NPM_PRODUCTION_PACKAGER_VERSION}}
env:
Expand All @@ -257,13 +259,13 @@ runs:
DOTNET_TieredPGO: "1"

- name: "Install Octopus Deploy CLI"
if: ${{steps.build_tools.outputs.BUILD_ENV == 'true' && inputs.OCTOPUS_DEPLOY_PACKAGE != ''}}
if: steps.build_tools.outputs.BUILD_ENV == 'true' && inputs.OCTOPUS_DEPLOY_PACKAGE != ''
uses: OctopusDeploy/[email protected]
with:
version: latest

- name: "Create Release Notes"
if: ${{steps.build_tools.outputs.BUILD_ENV == 'true'}}
if: steps.build_tools.outputs.BUILD_ENV == 'true'
shell: bash
run: dotnet changelog --changelog CHANGELOG.md --extract RELEASE_NOTES.md --version "${{env.BUILD_VERSION}}"
env:
Expand All @@ -277,7 +279,7 @@ runs:
DOTNET_TieredPGO: "1"

- name: "Read Release Notes"
if: ${{steps.build_tools.outputs.BUILD_ENV == 'true'}}
if: steps.build_tools.outputs.BUILD_ENV == 'true'
id: release-notes
uses: juliangruber/read-file-action@v1
with:
Expand All @@ -287,7 +289,7 @@ runs:
# DOTNET BUILD
############################################################################################################
- name: "Dotnet: Build"
if: ${{steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true'}}
if: steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true'
uses: ./.github/actions/dotnet
with:
BUILD_VERSION: ${{env.BUILD_VERSION}}
Expand All @@ -307,7 +309,7 @@ runs:
# NPM BUILD
############################################################################################################
- name: "Npm: Build"
if: ${{steps.check_files.outputs.NPM_EXIST == 'true'}}
if: steps.check_files.outputs.NPM_EXIST == 'true'
uses: ./.github/actions/npm
with:
BUILD_VERSION: ${{env.BUILD_VERSION}}
Expand All @@ -325,7 +327,11 @@ runs:
############################################################################################################

- name: "Dotnet: Push package to Octopus (EXE and DB)"
if: ${{steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true' && steps.check_files.outputs.SQL_EXIST == 'true' && inputs.OCTOPUS_DEPLOY_PACKAGE != ''}}
if: |-
steps.check_files.outputs.CSPROJ_EXIST == 'true' &&
steps.check_files.outputs.SLN_EXIST == 'true' &&
steps.check_files.outputs.SQL_EXIST == 'true' &&
inputs.OCTOPUS_DEPLOY_PACKAGE != ''
shell: bash
run: octopus package upload --no-prompt --overwrite-mode=ignore --package="${{github.workspace}}/${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-win-x64.${{env.BUILD_VERSION}}.zip" --package="${{github.workspace}}/${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-linux-x64.${{env.BUILD_VERSION}}.zip" --package="${{github.workspace}}/${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-linux-arm64.${{env.BUILD_VERSION}}.zip" --package="${{github.workspace}}/${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-database.${{env.BUILD_VERSION}}.zip"
env:
Expand All @@ -334,7 +340,11 @@ runs:
OCTOPUS_SPACE: "${{inputs.OCTOPUS_SPACE_NAME}}"

- name: "Dotnet: Push package to Octopus (EXE ONLY)"
if: ${{steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true' && steps.check_files.outputs.SQL_EXIST != 'true' && inputs.OCTOPUS_DEPLOY_PACKAGE != ''}}
if: |-
steps.check_files.outputs.CSPROJ_EXIST == 'true' &&
steps.check_files.outputs.SLN_EXIST == 'true' &&
steps.check_files.outputs.SQL_EXIST != 'true' &&
inputs.OCTOPUS_DEPLOY_PACKAGE != ''
shell: bash
run: octopus package upload --no-prompt --overwrite-mode=ignore --package="${{github.workspace}}/${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-win-x64.${{env.BUILD_VERSION}}.zip" --package="${{github.workspace}}/${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-linux-x64.${{env.BUILD_VERSION}}.zip" --package="${{github.workspace}}/${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-linux-arm64.${{env.BUILD_VERSION}}.zip"
env:
Expand All @@ -343,7 +353,10 @@ runs:
OCTOPUS_SPACE: "${{inputs.OCTOPUS_SPACE_NAME}}"

- name: "Dotnet: Push package to Octopus (NPM NUPKG ONLY)"
if: ${{steps.check_files.outputs.NPM_EXIST == 'true' && steps.check_files.outputs.NPM_SIGNING_EXIST == 'true' && inputs.OCTOPUS_DEPLOY_PACKAGE != ''}}
if: |-
steps.check_files.outputs.NPM_EXIST == 'true' &&
steps.check_files.outputs.NPM_SIGNING_EXIST == 'true' &&
inputs.OCTOPUS_DEPLOY_PACKAGE != ''
shell: bash
run: octopus package upload --no-prompt --overwrite-mode=ignore --package="${{github.workspace}}/${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-${{env.BUILD_VERSION}}.nupkg"
env:
Expand All @@ -352,7 +365,13 @@ runs:
OCTOPUS_SPACE: "${{inputs.OCTOPUS_SPACE_NAME}}"

- name: "Dotnet: Create Octopus Release (EXE and DB)"
if: ${{steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true' && steps.check_files.outputs.SQL_EXIST == 'true' && inputs.OCTOPUS_DEPLOY_PACKAGE != '' && inputs.OCTOPUS_CHANNEL != '' && env.DEPLOY == 'true'}}
if: |-
steps.check_files.outputs.CSPROJ_EXIST == 'true' &&
steps.check_files.outputs.SLN_EXIST == 'true' &&
steps.check_files.outputs.SQL_EXIST == 'true' &&
inputs.OCTOPUS_DEPLOY_PACKAGE != '' &&
inputs.OCTOPUS_CHANNEL != '' &&
env.DEPLOY == 'true'
shell: bash
run: octopus release create --no-prompt --project="${{inputs.OCTOPUS_PROJECT}}" --version="${{env.BUILD_VERSION}}" --channel="${{inputs.OCTOPUS_CHANNEL}}" --package="${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-win-x64:${{env.BUILD_VERSION}}" --package="${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-linux-x64:${{env.BUILD_VERSION}}" --package="${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-linux-arm64:${{env.BUILD_VERSION}}" --package="${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-database:${{env.BUILD_VERSION}}" --release-notes-file="RELEASE_NOTES.md"
env:
Expand All @@ -361,7 +380,13 @@ runs:
OCTOPUS_SPACE: "${{inputs.OCTOPUS_SPACE_NAME}}"

- name: "Dotnet: Create Octopus Release (EXE ONLY)"
if: ${{steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true' && steps.check_files.outputs.SQL_EXIST != 'true' && inputs.OCTOPUS_DEPLOY_PACKAGE != '' && inputs.OCTOPUS_CHANNEL != '' && env.DEPLOY == 'true'}}
if: |-
steps.check_files.outputs.CSPROJ_EXIST == 'true' &&
steps.check_files.outputs.SLN_EXIST == 'true' &&
steps.check_files.outputs.SQL_EXIST != 'true' &&
inputs.OCTOPUS_DEPLOY_PACKAGE != '' &&
inputs.OCTOPUS_CHANNEL != '' &&
env.DEPLOY == 'true'
shell: bash
run: octopus release create --no-prompt --project="${{inputs.OCTOPUS_PROJECT}}" --version="${{env.BUILD_VERSION}}" --channel="${{inputs.OCTOPUS_CHANNEL}}" --package="${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-win-x64:${{env.BUILD_VERSION}}" --package="${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-linux-x64:${{env.BUILD_VERSION}}" --package="${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}-linux-arm64:${{env.BUILD_VERSION}}" --release-notes-file="RELEASE_NOTES.md"
env:
Expand All @@ -370,7 +395,10 @@ runs:
OCTOPUS_SPACE: "${{inputs.OCTOPUS_SPACE_NAME}}"

- name: "Dotnet: Create Octopus Release (NPM ONLY)"
if: ${{steps.check_files.outputs.NPM_EXIST == 'true' && steps.check_files.outputs.NPM_SIGNING_EXIST == 'true' && inputs.OCTOPUS_DEPLOY_PACKAGE != ''}}
if: |-
steps.check_files.outputs.NPM_EXIST == 'true' &&
steps.check_files.outputs.NPM_SIGNING_EXIST == 'true' &&
inputs.OCTOPUS_DEPLOY_PACKAGE != ''
shell: bash
run: octopus release create --no-prompt --project="${{inputs.OCTOPUS_PROJECT}}" --version="${{env.BUILD_VERSION}}" --channel="${{inputs.OCTOPUS_CHANNEL}}" --package="${{inputs.OCTOPUS_DEPLOY_PACKAGE_ZIP}}:${{env.BUILD_VERSION}}" --release-notes-file="RELEASE_NOTES.md"
env:
Expand All @@ -379,7 +407,12 @@ runs:
OCTOPUS_SPACE: "${{inputs.OCTOPUS_SPACE_NAME}}"

- name: "Deploy Octopus Release"
if: ${{((steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true') || (steps.check_files.outputs.NPM_EXIST == 'true' && steps.check_files.outputs.NPM_SIGNING_EXIST == 'true')) && inputs.OCTOPUS_DEPLOY_PACKAGE != '' && inputs.OCTOPUS_CHANNEL != '' && env.DEPLOY == 'true'}}
if: |-
((steps.check_files.outputs.CSPROJ_EXIST == 'true' && steps.check_files.outputs.SLN_EXIST == 'true') ||
(steps.check_files.outputs.NPM_EXIST == 'true' && steps.check_files.outputs.NPM_SIGNING_EXIST == 'true')) &&
inputs.OCTOPUS_DEPLOY_PACKAGE != '' &&
inputs.OCTOPUS_CHANNEL != '' &&
env.DEPLOY == 'true'
shell: bash
run: octopus release deploy --no-prompt --project="${{inputs.OCTOPUS_PROJECT}}" --version="${{env.BUILD_VERSION}}" --environment="${{inputs.OCTOPUS_DEPLOY_TO}}"
env:
Expand All @@ -391,7 +424,7 @@ runs:
# Create GitHub Release
############################################################################################################
- name: "Create Release"
if: ${{steps.build_tools.outputs.BUILD_ENV == 'true' && inputs.CREATE_RELEASE == 'true'}}
if: steps.build_tools.outputs.BUILD_ENV == 'true' && inputs.CREATE_RELEASE == 'true'
id: create_release
uses: ncipollo/release-action@v1
with:
Expand Down

0 comments on commit 9bcc938

Please sign in to comment.