From 4a58bb67642e514719e1fce3c4aa920d3b814166 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Fri, 29 Sep 2023 13:52:05 -0700 Subject: [PATCH] Copy github action from `auto-rmskin-package` --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1bbea04 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +# Taken from https://github.com/brianferguson/auto-rmskin-package/blob/e4810692822c8e1b9ed3b89993ed9a50d2a8f251/.github/workflows/release.yml +name: auto-rmskin-package + +on: + release: + types: + - created + +jobs: + package: + runs-on: windows-latest + outputs: + target: ${{ steps.create_rmskin.outputs.target }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Create rmskin + shell: powershell + id: create_rmskin + run: | + Write-Output "Compressing archive: RMSKIN/*" + $target = "${{ github.event.repository.name }}_${{ github.event.release.tag_name }}.zip" + Compress-Archive -Path ./RMSKIN/* -DestinationPath $target + Write-Output "Archive: $target" + + Write-Output "Writing footer..." + $size = [long](Get-Item $target).length + $size_bytes = [System.BitConverter]::GetBytes($size) + Add-Content -Path $target -Value $size_bytes -Encoding Byte + + $flags = [byte]0 + Add-Content -Path $target -Value $flags -Encoding Byte + + $rmskin = [string]"RMSKIN`0" + Add-Content -Path $target -Value $rmskin -NoNewLine -Encoding ASCII + + Write-Output "Changing .zip to .rmskin" + Rename-Item -Path $target -NewName ([io.path]::ChangeExtension($target, '.rmskin')) + $target = $target.Replace(".zip", ".rmskin") + Write-Output "File to upload: $target" + + echo "::set-output name=target::$target" + + - name: Upload rmskin + id: upload_rmskin + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_name: ${{ steps.create_rmskin.outputs.target }} + asset_path: ${{ steps.create_rmskin.outputs.target }} + asset_content_type: application/octet-stream