diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e66efa5..13d5240 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,34 +10,16 @@ jobs: release: runs-on: ubuntu-latest steps: - + - uses: actions/checkout@v3 - + - name: Get new version id: new-version uses: arwynfr/actions-conventional-versioning/get-newVersion@v1 - name: 'Copy templates' shell: pwsh - run: Copy-Item src/.templates out/ArmaServer/.templates -Recurse -Force - - - name: 'Copy manifest' - shell: pwsh - run: Copy-Item build/ArmaServer.psd1 out/ArmaServer/ArmaServer.psd1 -Force - - - name: 'Make module file' - shell: pwsh - run: Get-ChildItem src -Filter '*.ps1' | & build/New-PowershellModuleFile.ps1 -DestinationPath out/ArmaServer/ArmaServer.psm1 -Force - - - name: 'Update manifest version' - shell: pwsh - run: Update-ModuleManifest -ModuleVersion ${{ steps.new-version.outputs.next-version }} out/ArmaServer/ArmaServer.psd1 - - - name: 'Publish to PSGallery' - uses: aammirmirza/Publish2PSGallery@PSGallery_v2 - with: - NuGetApiKey: ${{ secrets.PSGALLERY_APIKEY }} - modulePath: out/ArmaServer + run: build/Release.ps1 -Version ${{ steps.new-version.outputs.next-version }} -ApiKey ${{ secrets.PSGALLERY_APIKEY }} - name: Tag new version on the repository - uses: arwynfr/actions-conventional-versioning@v1 \ No newline at end of file + uses: arwynfr/actions-conventional-versioning@v1 diff --git a/build/Release.ps1 b/build/Release.ps1 new file mode 100644 index 0000000..69f88bc --- /dev/null +++ b/build/Release.ps1 @@ -0,0 +1,21 @@ +[CmdletBinding()] +param ( + [Parameter(Mandatory)] + [semver] + $Version, + + [Parameter(Mandatory)] + [string] + $ApiKey +) + +$Root = Convert-Path $PSScriptRoot/.. +$Sources = Join-Path $Root src +$Builds = Join-Path $Root build +$Destination = Join-Path $Root out/ArmaServer + +Copy-Item $Sources/.templates $Destination/.templates -Recurse -Force +Copy-Item $Builds/ArmaServer.psd1 $Destination/ArmaServer.psd1 -Force +Get-ChildItem $Sources -Filter '*.ps1' | & $Builds/New-PowershellModuleFile.ps1 -DestinationPath $Destination/ArmaServer.psm1 -Force +Update-ModuleManifest -ModuleVersion $Version $Destination/ArmaServer.psd1 +Publish-Module -Path $Destination -NuGetApiKey $ApiKey \ No newline at end of file