Fix #581 #757
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: BLENDERMALT_PACKAGE_AND_RELEASE | |
on: | |
push: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: nelonoel/[email protected] | |
- name: Rollback Release | |
uses: author/action-rollback@stable | |
continue-on-error: true | |
with: | |
tag: ${{ env.BRANCH_NAME }}-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ github.ref_type == 'branch' }} | |
- uses: ncipollo/release-action@v1 | |
id: create_release | |
if: ${{ github.ref_type == 'branch' }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
tag: ${{ env.BRANCH_NAME }}-latest | |
commit: ${{ github.sha }} | |
prerelease: ${{ env.BRANCH_NAME != 'Release' }} | |
body: | | |
[**BlenderMalt-Windows.zip**](https://github.com/${{github.repository}}/releases/download/${{env.BRANCH_NAME}}-latest/BlenderMalt-Windows.zip) | |
[**BlenderMalt-Linux.zip**](https://github.com/${{github.repository}}/releases/download/${{env.BRANCH_NAME}}-latest/BlenderMalt-Linux.zip) | |
- name: Rollback Tagged Release | |
uses: author/action-rollback@stable | |
continue-on-error: true | |
with: | |
tag: ${{ github.action_ref }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ github.ref_type == 'tag' }} | |
- uses: ncipollo/release-action@v1 | |
id: create_tagged_release | |
if: ${{ github.ref_type == 'tag' }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit: ${{ github.sha }} | |
allowUpdates: true | |
prerelease: ${{ env.BRANCH_NAME != 'Release' }} | |
body: | | |
[**BlenderMalt-Windows.zip**](https://github.com/${{github.repository}}/releases/download/${{github.ref_name}}/BlenderMalt-Windows.zip) | |
[**BlenderMalt-Linux.zip**](https://github.com/${{github.repository}}/releases/download/${{github.ref_name}}/BlenderMalt-Linux.zip) | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
release_id: ${{ steps.create_release.outputs.id }} | |
tagged_upload_url: ${{ steps.create_tagged_release.outputs.upload_url }} | |
tagged_release_id: ${{ steps.create_tagged_release.outputs.id }} | |
package-blender: | |
needs: [release] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: setup_blender_addon.py | |
run: python setup_blender_addon.py --copy-modules | |
working-directory: ${{ github.workspace }}/scripts | |
- name: Zip Addon | |
shell: python | |
run: | | |
import shutil | |
shutil.make_archive('BlenderMalt', 'zip', '.', 'BlenderMalt') | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: BlenderMalt-${{ runner.os }} | |
path: ${{ github.workspace }}/BlenderMalt.zip | |
- name: Remove Old Files | |
uses: flcdrg/remove-release-asset-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.release.outputs.release_id }} | |
asset_name: BlenderMalt-${{ runner.os }}.zip | |
continue-on-error: true | |
if: ${{ github.ref_type == 'branch' }} | |
- name: Release Addon | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ${{ github.workspace }}/BlenderMalt.zip | |
asset_name: BlenderMalt-${{ runner.os }}.zip | |
asset_content_type: application/zip | |
if: ${{ github.ref_type == 'branch' }} | |
- name: Remove Old Tagged Files | |
uses: flcdrg/remove-release-asset-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.release.outputs.tagged_release_id }} | |
asset_name: BlenderMalt-${{ runner.os }}.zip | |
continue-on-error: true | |
if: ${{ github.ref_type == 'tag' }} | |
- name: Release Tagged Addon | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.tagged_upload_url }} | |
asset_path: ${{ github.workspace }}/BlenderMalt.zip | |
asset_name: BlenderMalt-${{ runner.os }}.zip | |
asset_content_type: application/zip | |
if: ${{ github.ref_type == 'tag' }} |