Skip to content

Commit

Permalink
make publish workflow automatically parse plugin name, instead of pro…
Browse files Browse the repository at this point in the history
…viding one in workflow
  • Loading branch information
Rudokhvist committed Mar 12, 2024
1 parent 21fe714 commit 02aafb9
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ env:
DOTNET_NOLOGO: true
DOTNET_SDK_VERSION: 8.0
GPG_PRIVATE_KEY: ${{ secrets.ARCHIBOT_GPG_PRIVATE_KEY }} # Optional, if secret not provided, will skip signing SHA512SUMS with GPG key. You can specify your own credentials if you'd like to, simply change ARCHIBOT_GPG_PRIVATE_KEY here to the one you want to use
PLUGIN_NAME: MyAwesomePlugin

permissions:
contents: read
Expand All @@ -21,6 +20,8 @@ jobs:
os: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}
outputs:
PLUGIN_NAME: ${{ steps.getname.outputs.info }}

steps:
- name: Checkout code
Expand All @@ -29,6 +30,13 @@ jobs:
show-progress: false
submodules: recursive

- name: Get name
id: getname
uses: mavrosxristoforos/[email protected]
with:
xml-file: 'Directory.Build.props'
xpath: '//PluginName'

- name: Setup .NET Core
uses: actions/[email protected]
with:
Expand All @@ -39,6 +47,8 @@ jobs:

- name: Publish plugin on Unix
if: startsWith(matrix.os, 'macos-') || startsWith(matrix.os, 'ubuntu-')
env:
PLUGIN_NAME: ${{ steps.getname.outputs.info }}
shell: sh
run: |
set -eu
Expand Down Expand Up @@ -91,6 +101,8 @@ jobs:
- name: Publish plugin on Windows
if: startsWith(matrix.os, 'windows-')
env:
PLUGIN_NAME: ${{ steps.getname.outputs.info }}
shell: pwsh
run: |
Set-StrictMode -Version Latest
Expand Down Expand Up @@ -124,8 +136,8 @@ jobs:
- name: Upload plugin artifact
uses: actions/[email protected]
with:
name: ${{ matrix.os }}_${{ env.PLUGIN_NAME }}
path: out/${{ env.PLUGIN_NAME }}.zip
name: ${{ matrix.os }}_${{ steps.getname.outputs.info }}
path: out/${{ steps.getname.outputs.info }}.zip

release:
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
Expand All @@ -144,7 +156,7 @@ jobs:
- name: Download plugin artifact from ubuntu-latest
uses: actions/[email protected]
with:
name: ubuntu-latest_${{ env.PLUGIN_NAME }}
name: ubuntu-latest_${{ needs.publish.outputs.PLUGIN_NAME }}
path: out

- name: Import GPG key for signing
Expand Down Expand Up @@ -187,6 +199,6 @@ jobs:
artifacts: "out/*"
bodyFile: .github/RELEASE_TEMPLATE.md
makeLatest: false
name: ${{ env.PLUGIN_NAME }} V${{ github.ref_name }}
name: ${{ needs.publish.outputs.PLUGIN_NAME }} V${{ github.ref_name }}
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 02aafb9

Please sign in to comment.