Skip to content

Commit

Permalink
ci: fix publish workflow (#282)
Browse files Browse the repository at this point in the history
* ci: change framework to net9

* ci: change config parser

* ci: change config parser

* ci: correct action inputs

* ci: change actions

* ci: fix publish action

* ci: fix publish action

* ci: remove unused action

* ci: rename workflow step
  • Loading branch information
al-kau authored Dec 17, 2024
1 parent 691bece commit b4a1fa3
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 123 deletions.
34 changes: 0 additions & 34 deletions .github/actions/publish-config-parser/action.yml

This file was deleted.

53 changes: 28 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ on:
types: [published]

env:
dotnet-version: 9.x
default-config-file: "./publish/config.json"
default-target-os: all
default-target-runtime: all
Expand All @@ -42,12 +41,11 @@ jobs:
runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.publish-config-parser.outputs.profiles }}
status: ${{ steps.checker.outputs.status }}
project-file: ${{ steps.publish-config-parser.outputs.project-file }}
output-name: ${{ steps.publish-config-parser.outputs.output-name }}
target-os: ${{ steps.inputs.outputs.target-os }}
target-runtime: ${{ steps.inputs.outputs.target-runtime }}
matrix: ${{ steps.select-config.outputs.matrix }}
project-file: ${{ fromJSON(steps.read-options.outputs.content).project-file }}
output-name: ${{ fromJSON(steps.read-options.outputs.content).output-name }}

steps:
- name: Checkout
Expand All @@ -67,12 +65,20 @@ jobs:
echo "target-os=${target_os:=${{ env.default-target-os }}}" >> $GITHUB_OUTPUT
echo "target-runtime=${target_runtime:=${{ env.default-target-runtime }}}" >> $GITHUB_OUTPUT
- name: Parse configuration "${{ github.event.inputs.config-file }}"
id: publish-config-parser
uses: ./.github/actions/publish-config-parser
- name: Read options "${{ github.event.inputs.config-file }}"
id: read-options
uses: finebits/github-actions/toolset/file/read@4a126d80a11c5fdc83ce884d3d23dffb30bc4495 # v2.0.0
with:
config-file: ${{ env.config-file }}
tags: "${{ env.target-os }},${{ env.target-runtime }}"
file: ${{ steps.inputs.outputs.config-file }}

- name: Select configuration "${{ github.event.inputs.config-file }}"
id: select-config
uses: finebits/github-actions/toolset/select-configuration@4a126d80a11c5fdc83ce884d3d23dffb30bc4495 # v2.0.0
with:
json-file: ${{ env.config-file }}
keywords: "${{ env.target-os }},${{ env.target-runtime }}"
configs-set-jsonpath: ".profiles"
keywords-set-jsonpath: ".tags"
env:
config-file: ${{ steps.inputs.outputs.config-file }}
target-os: ${{ steps.inputs.outputs.target-os }}
Expand All @@ -81,20 +87,16 @@ jobs:
- name: Check profiles
id: checker
run: |
profiles='${{ steps.publish-config-parser.outputs.profiles }}'
length=$( echo $profiles | jq '.include | length' )
if(( $length > 0 )); then
echo "status=success" >> $GITHUB_OUTPUT
else
echo "status=failure" >> $GITHUB_OUTPUT
echo "No suitable publish profile found"
length=$( echo '${{ steps.select-config.outputs.config-json }}' | jq '. | length' )
if(( $length == 0 )); then
echo "::error::No suitable publish configuration found"
exit 1
fi
publish:
name: Publish
needs: prepare
if: needs.prepare.outputs.status == 'success'
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJson(needs.prepare.outputs.matrix)}}
Expand All @@ -104,6 +106,7 @@ jobs:
version-short: "${{ steps.version-number.outputs.preset-suffix }}"

env:
dotnet-version: ${{ matrix.dotnet }}
output-name: ${{ needs.prepare.outputs.output-name }}
project-file: ${{ needs.prepare.outputs.project-file }}
configuration: ${{ matrix.configuration }}
Expand Down Expand Up @@ -134,20 +137,20 @@ jobs:
- uses: finebits/github-actions/toolset/file/replace-text@4a126d80a11c5fdc83ce884d3d23dffb30bc4495 # v2.0.0
with:
file: ./src/Eppie.CLI/Eppie.CLI/Options/AuthorizationOptions.cs
placeholder: '\"<Gmail-ClientId>\"'
value: "${{ secrets.GMAIL_CLIENT_ID }}"
find-what: '\"<Gmail-ClientId>\"'
replace-with: "${{ secrets.GMAIL_CLIENT_ID }}"

- uses: finebits/github-actions/toolset/file/replace-text@4a126d80a11c5fdc83ce884d3d23dffb30bc4495 # v2.0.0
with:
file: ./src/Eppie.CLI/Eppie.CLI/Options/AuthorizationOptions.cs
placeholder: '\"<Gmail-ClientSecret>\"'
value: "${{ secrets.GMAIL_CLIENT_SECRET }}"
find-what: '\"<Gmail-ClientSecret>\"'
replace-with: "${{ secrets.GMAIL_CLIENT_SECRET }}"

- uses: finebits/github-actions/toolset/file/replace-text@4a126d80a11c5fdc83ce884d3d23dffb30bc4495 # v2.0.0
with:
file: ./src/Eppie.CLI/Eppie.CLI/Options/AuthorizationOptions.cs
placeholder: '\"<Outlook-ClientId>\"'
value: "${{ secrets.OUTLOOK_CLIENT_ID }}"
find-what: '\"<Outlook-ClientId>\"'
replace-with: "${{ secrets.OUTLOOK_CLIENT_ID }}"

- name: Publish ${{ env.output-name }} [${{ env.version-short }}]
run: |
Expand Down
40 changes: 24 additions & 16 deletions publish/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,79 @@
"os": "windows-latest",
"runtime": "win-x86",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle"
"framework": "net9.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle",
"dotnet": "9.x"
},

{
"tags": ["windows", "x64", "all"],
"os": "windows-latest",
"runtime": "win-x64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle"
"framework": "net9.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle",
"dotnet": "9.x"
},

{
"tags": ["windows", "arm64", "all"],
"os": "windows-latest",
"runtime": "win-arm64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle"
"framework": "net9.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle",
"dotnet": "9.x"
},

{
"tags": ["linux", "x64", "all"],
"os": "ubuntu-latest",
"runtime": "linux-x64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle"
"framework": "net9.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle",
"dotnet": "9.x"
},

{
"tags": ["linux", "arm", "all"],
"os": "ubuntu-latest",
"runtime": "linux-arm",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle"
"framework": "net9.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle",
"dotnet": "9.x"
},

{
"tags": ["linux", "arm64", "all"],
"os": "ubuntu-latest",
"runtime": "linux-arm64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle"
"framework": "net9.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle",
"dotnet": "9.x"
},

{
"tags": ["macos", "x64", "all"],
"os": "macos-latest",
"runtime": "osx-x64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle"
"framework": "net9.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle",
"dotnet": "9.x"
},

{
"tags": ["macos", "arm64", "all"],
"os": "macos-latest",
"runtime": "osx-arm64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle"
"framework": "net9.0",
"options" : "--self-contained --property:PublishSingleFile=true --property:DebugSymbols=false --property:DebugType=None --property:GenerateDocumentationFile=fasle",
"dotnet": "9.x"
}
]
}
40 changes: 24 additions & 16 deletions publish/config.options-off.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,79 @@
"os": "windows-latest",
"runtime": "win-x86",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:DebugType=None"
"framework": "net9.0",
"options" : "--self-contained --property:DebugType=None",
"dotnet": "9.x"
},

{
"tags": ["windows", "x64", "all"],
"os": "windows-latest",
"runtime": "win-x64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:DebugType=None"
"framework": "net9.0",
"options" : "--self-contained --property:DebugType=None",
"dotnet": "9.x"
},

{
"tags": ["windows", "arm64", "all"],
"os": "windows-latest",
"runtime": "win-arm64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:DebugType=None"
"framework": "net9.0",
"options" : "--self-contained --property:DebugType=None",
"dotnet": "9.x"
},

{
"tags": ["linux", "x64", "all"],
"os": "ubuntu-latest",
"runtime": "linux-x64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:DebugType=None"
"framework": "net9.0",
"options" : "--self-contained --property:DebugType=None",
"dotnet": "9.x"
},

{
"tags": ["linux", "arm", "all"],
"os": "ubuntu-latest",
"runtime": "linux-arm",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:DebugType=None"
"framework": "net9.0",
"options" : "--self-contained --property:DebugType=None",
"dotnet": "9.x"
},

{
"tags": ["linux", "arm64", "all"],
"os": "ubuntu-latest",
"runtime": "linux-arm64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:DebugType=None"
"framework": "net9.0",
"options" : "--self-contained --property:DebugType=None",
"dotnet": "9.x"
},

{
"tags": ["macos", "x64", "all"],
"os": "macos-latest",
"runtime": "osx-x64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:DebugType=None"
"framework": "net9.0",
"options" : "--self-contained --property:DebugType=None",
"dotnet": "9.x"
},

{
"tags": ["macos", "arm64", "all"],
"os": "macos-latest",
"runtime": "osx-arm64",
"configuration": "release",
"framework": "net8.0",
"options" : "--self-contained --property:DebugType=None"
"framework": "net9.0",
"options" : "--self-contained --property:DebugType=None",
"dotnet": "9.x"
}
]
}
Loading

0 comments on commit b4a1fa3

Please sign in to comment.