|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: write |
| 8 | + |
| 9 | +jobs: |
| 10 | + update-version: |
| 11 | + name: Set __version__ to Frappe version-16 |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 18 | + |
| 19 | + - name: Get current Frappe version (version-16 branch) |
| 20 | + id: frappe-version |
| 21 | + run: | |
| 22 | + VERSION=$(curl -sSf "https://raw.githubusercontent.com/frappe/frappe/version-16/frappe/__init__.py" | grep -E '^__version__\s*=' | sed -E "s/__version__\s*=\s*['\"]([^'\"]+)['\"].*/\1/") |
| 23 | + if [ -z "$VERSION" ]; then |
| 24 | + echo "Could not determine Frappe version from version-16 branch" |
| 25 | + exit 1 |
| 26 | + fi |
| 27 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 28 | + echo "Frappe version (version-16): $VERSION" |
| 29 | +
|
| 30 | + - name: Update __version__ in forms_pro |
| 31 | + run: | |
| 32 | + FILE="forms_pro/__init__.py" |
| 33 | + if [ ! -f "$FILE" ]; then |
| 34 | + FILE="apps/forms_pro/forms_pro/__init__.py" |
| 35 | + fi |
| 36 | + if [ ! -f "$FILE" ]; then |
| 37 | + echo "Could not find __init__.py (tried forms_pro/__init__.py and apps/forms_pro/forms_pro/__init__.py)" |
| 38 | + exit 1 |
| 39 | + fi |
| 40 | + VERSION="${{ steps.frappe-version.outputs.version }}" |
| 41 | + sed -i.bak -E "s/^__version__\s*=\s*['\"][^'\"]*['\"]/__version__ = \"$VERSION\"/" "$FILE" && rm -f "${FILE}.bak" |
| 42 | + echo "Updated $FILE to __version__ = \"$VERSION\"" |
| 43 | + cat "$FILE" |
| 44 | +
|
| 45 | + - name: Commit and push |
| 46 | + run: | |
| 47 | + FILE="forms_pro/__init__.py" |
| 48 | + [ -f "$FILE" ] || FILE="apps/forms_pro/forms_pro/__init__.py" |
| 49 | + git config user.name "github-actions[bot]" |
| 50 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 51 | + git add "$FILE" |
| 52 | + if git diff --staged --quiet; then |
| 53 | + echo "No change: __version__ already set to ${{ steps.frappe-version.outputs.version }}" |
| 54 | + exit 0 |
| 55 | + fi |
| 56 | + git commit -m "chore: set __version__ to Frappe version-16 (${{ steps.frappe-version.outputs.version }})" |
| 57 | + git push |
0 commit comments