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

Make publish workflow automatically parse plugin name #25

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}