Skip to content

version-update-and-push #441

version-update-and-push

version-update-and-push #441

name: version-update
on:
repository_dispatch:
types: [version-update-and-push]
permissions:
contents: read
jobs:
version-update:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: develop
- name: Configure properties
run: bash .github/scripts/setup-config.sh
- name: Generate version information
run: |
# Extract version from event payload
VERSION="${{ github.event.client_payload.version }}"
echo "$VERSION" > VERSION
# Parse and compute code
IFS='.' read -ra VER <<< "$VERSION"
MAJOR=$((VER[0] * 1000000000))
MINOR=$((VER[1] * 1000000))
PATCH=$((VER[2] * 1000))
CODE=$((MAJOR + MINOR + PATCH))
# Create version.properties
mkdir -p gradle
cat <<EOF > gradle/version.properties
version=$VERSION
code=$CODE
name=v$VERSION
EOF
# Create version.json
mkdir -p .meta
cat <<EOF > .meta/version.json
{
"code": $CODE,
"migration": false,
"minSdk": 21,
"releaseNotes": "",
"version": "$VERSION",
"appId": "com.mxt.anitrend"
}
EOF
- name: Preview created files
run: |
echo "Preview version.properties:"
cat gradle/version.properties
echo "Preview version.json:"
cat .meta/version.json
- name: Clean up temporary files
run: rm VERSION
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
signoff: true
delete-branch: true
commit-message: "automation: update version.properties and version.json"
author: "Author <[email protected]>"
title: "platform: automated version update"
body: |
This PR was automatically generated to update `version.properties` and `.meta/version.json`
branch: platform/update-version-meta-data
labels: "skip-changelog"
assignees: "wax911"
reviewers: "wax911"