From 680766ffdb76429ca68609931c44d2a149a7154e Mon Sep 17 00:00:00 2001 From: Travis Spomer <16262858+TravisSpomer@users.noreply.github.com> Date: Thu, 24 Feb 2022 08:28:46 -0800 Subject: [PATCH] Add publishing workflow --- .github/workflows/package-addon.yml | 102 ++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/package-addon.yml diff --git a/.github/workflows/package-addon.yml b/.github/workflows/package-addon.yml new file mode 100644 index 0000000..8bb3b5c --- /dev/null +++ b/.github/workflows/package-addon.yml @@ -0,0 +1,102 @@ +name: Package World of Warcraft addon + +on: + workflow_dispatch: + inputs: + version: + description: 'Addon version' + required: true + +env: + CLASSIC_VERSION: 11402 + BURNING_CRUSADE_VERSION: 20503 + +jobs: + package: + name: Create zips and tag + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Get name of addon + id: init + run: | + addon_name=$(ls *.toc) + addon_name=$(basename $addon_name .toc) + tag_name=${addon_name}-${{github.event.inputs.version}} + echo "::set-output name=addon_name::${addon_name}" + echo "::set-output name=tag_name::${tag_name}" + + - name: Make folder for zips + run: | + mkdir -p .releases/${{steps.init.outputs.addon_name}} + rsync -r --exclude '.*' . .releases/${{steps.init.outputs.addon_name}} + + - name: Create retail zip + run: | + cd .releases + zip -9 -r ${{steps.init.outputs.tag_name}}.zip ${{steps.init.outputs.addon_name}} + cd .. + + - name: Replace TOC version for Classic + run: | + sed -i 's/Interface: *[0-9]\+/Interface: ${{env.CLASSIC_VERSION}}/g' .releases/${{steps.init.outputs.addon_name}}/${{steps.init.outputs.addon_name}}.toc + + - name: Create Classic zip + run: | + cd .releases + zip -9 -r ${{steps.init.outputs.tag_name}}-Classic.zip ${{steps.init.outputs.addon_name}} + cd .. + + - name: Replace TOC version for Burning Crusade + run: | + sed -i 's/Interface: *[0-9]\+/Interface: ${{env.BURNING_CRUSADE_VERSION}}/g' .releases/${{steps.init.outputs.addon_name}}/${{steps.init.outputs.addon_name}}.toc + + - name: Create Burning Crusade zip + run: | + cd .releases + zip -9 -r ${{steps.init.outputs.tag_name}}-BurningCrusade.zip ${{steps.init.outputs.addon_name}} + cd .. + + - name: Tag this version + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{steps.init.outputs.tag_name}} + release_name: ${{steps.init.outputs.addon_name}} ${{github.event.inputs.version}} + body: ${{steps.init.outputs.addon_name}} ${{github.event.inputs.version}} + draft: false + prerelease: false + + - name: Add retail zip to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .releases/${{steps.init.outputs.tag_name}}.zip + asset_name: ${{steps.init.outputs.tag_name}}.zip + asset_content_type: application/zip + + - name: Add Classic zip to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .releases/${{steps.init.outputs.tag_name}}-Classic.zip + asset_name: ${{steps.init.outputs.tag_name}}-Classic.zip + asset_content_type: application/zip + + - name: Add Burning Crusade zip to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .releases/${{steps.init.outputs.tag_name}}-BurningCrusade.zip + asset_name: ${{steps.init.outputs.tag_name}}-BurningCrusade.zip + asset_content_type: application/zip