From 6683db81e5cb539d5531026e7c353ac8e6f9802c Mon Sep 17 00:00:00 2001 From: Greg Cockroft Date: Fri, 6 Dec 2024 11:42:28 -0500 Subject: [PATCH] add workflow for releases --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 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..e1166f0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Create Release for Batch Asset Importer + +on: + push: + tags: + - 'v*' # Trigger only when a tag starting with 'v' is pushed (e.g., v1.0.0, v2.3.4) + +jobs: + release: + name: Build and Release + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout the repository + - name: Checkout Repository + uses: actions/checkout@v3 + + # Step 2: Extract the version from the tag + - name: Extract Version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + # Step 3: Zip the `batch_asset_importer` folder with version in filename + - name: Zip the Addon + run: | + mkdir release + cp -r batch_asset_importer release/ + cd release + zip -r "batch_asset_importer_${VERSION}.zip" batch_asset_importer/ + + # Step 4: Upload the ZIP as a GitHub Release Asset + - name: Create GitHub Release + uses: ncipollo/release-action@v1 + with: + artifacts: release/batch_asset_importer_${{ env.VERSION }}.zip # Path to the ZIP file with version + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} # Use the tag that triggered the workflow + name: Release ${{ github.ref_name }} # Name the release after the tag + body: | + **Batch Asset Importer Addon** + - Automatically generated release for version ${{ github.ref_name }} +