Skip to content

Manual Release Version #30

Manual Release Version

Manual Release Version #30

name: Manual Release Version
on: [workflow_dispatch]
jobs:
release-version:
name: Manual Release Version
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Verify current inputs godot_version
run: |
#BRANCH_NAME=${{ github.ref_name }}
- name: Define Godot version based on branch name
run: |
GODOT_VERSION=""
if [ "${{ github.ref_name }}" = "master" ]; then
GODOT_VERSION=4
elif [ "${{ github.ref_name }}" = "godot3" ]; then
GODOT_VERSION=3
else
echo "ERROR! Check if branch name matches with the pattern: godot?" && exit 1
fi
echo "GODOT_VERSION=${GODOT_VERSION}" >> $GITHUB_ENV
echo "TAG_PREFIX=godot${GODOT_VERSION}-" >> $GITHUB_ENV
- name: Get plugin version
uses: paulhatch/[email protected]
id: version
with:
tag_prefix: "${{env.TAG_PREFIX}}v"
major_pattern: "BREAKING CHANGE:"
minor_pattern: "feat:"
version_format: "v${major}.${minor}.${patch}"
- name: Change version
run: |
echo "PLUGIN_VERSION=${{env.TAG_PREFIX}}${{ steps.version.outputs.version }}" >> $GITHUB_ENV
REGEX_FIND_VERSION_TO_CHANGE_CONTENT_MD_FILE='(?<=version=")[^"]+'
perl -pi -e "s/$REGEX_FIND_VERSION_TO_CHANGE_CONTENT_MD_FILE/${{env.PLUGIN_VERSION}}/g" addons/admob/plugin.cfg
cat addons/admob/plugin.cfg
- name: Git Auto Commit
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add .
git commit -m "Auto changed version with CI/CD"
git push
echo "LAST_COMMIT_HASH=$(git log -1 --pretty=format:%H)" >> $GITHUB_ENV
- name: Create Release
uses: ncipollo/[email protected]
with:
generateReleaseNotes: true
commit: ${{env.LAST_COMMIT_HASH}}
tag: ${{env.PLUGIN_VERSION}}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install requests
run: pip install requests
- name: Upload new version to Godot Asset Library
env:
USERNAME: ${{ secrets.ASSET_LIBRARY_USERNAME }}
PASSWORD: ${{ secrets.ASSET_LIBRARY_PASSWORD }}
VERSION: ${{env.PLUGIN_VERSION}}
COMMIT_HASH: ${{env.LAST_COMMIT_HASH}}
run: |
python3 static/workflow_files/push.py