Create Release Draft #11
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: Create Release Draft | |
on: | |
workflow_dispatch: | |
push: | |
branches: [master] | |
env: | |
ARCHIVE_NAME: outer_scout | |
jobs: | |
check-manifest: | |
name: Check For Existing Release | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.out.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Read Addon Version | |
id: read-version | |
uses: SebRollen/[email protected] | |
with: | |
file: blender_manifest.toml | |
field: version | |
- name: Validate Version | |
uses: FidelusAleksander/[email protected] | |
id: validate-version | |
continue-on-error: true | |
with: | |
regex_pattern: '^\d+\.\d+\.\d+$' | |
text: "${{ steps.read-version.outputs.value }}" | |
- name: Error If Version Is Invalid | |
if: ${{ steps.validate-version.outputs.match == 'false' }} | |
run: | | |
echo "::error file=blender_manifest.toml,title=Refusing to Release::Version string is invalid" | |
exit 1 | |
- name: Check For Release | |
id: check-tag | |
uses: mukunku/[email protected] | |
with: | |
tag: v${{ steps.read-version.outputs.value }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Error If Release Exists | |
if: ${{ steps.check-tag.outputs.exists != 'false' }} | |
run: | | |
echo "::error file=blender_manifest.toml,title=Refusing to Release::There is already a release with the version in blender_manifest.toml" | |
exit 1 | |
- name: Output | |
id: out | |
run: | | |
echo "version=${{ steps.read-version.outputs.value }}" >> $GITHUB_OUTPUT | |
release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
needs: check-manifest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ./sources | |
- name: Remove Dev Files | |
working-directory: ./sources | |
run: | | |
rm -rf .git | |
rm -rf .github | |
rm .gitignore | |
rm .pre-commit-config.yaml | |
rm pyproject.toml | |
rm requirements-dev.txt | |
- name: Zip For Release | |
run: 7z a ./${{ env.ARCHIVE_NAME }}.zip "./sources/*" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARCHIVE_NAME }}.zip | |
path: ./${{ env.ARCHIVE_NAME }}.zip | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
commit: master | |
tag: v${{ needs.check-manifest.outputs.version }} | |
name: Version ${{ needs.check-manifest.outputs.version }} | |
omitBodyDuringUpdate: true | |
artifacts: ${{ env.ARCHIVE_NAME }}.zip | |
draft: true | |
prerelease: false | |
generateReleaseNotes: true |