-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
71 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,68 @@ | ||
name: version-updater | ||
name: version-update | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'platform/update-version-meta-data' | ||
|
||
workflow_dispatch: | ||
inputs: | ||
branchName: | ||
description: Pull request against branch | ||
default: 'platform/update-version-meta-data' | ||
type: choice | ||
options: | ||
- 'platform/update-version-meta-data' | ||
required: true | ||
|
||
repository_dispatch: | ||
types: [version-update-and-push] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
contents: read | ||
|
||
jobs: | ||
version-updater: | ||
version-update: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: develop | ||
- name: set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Configure dummy files | ||
run: | | ||
mv app/.travic-ci/google-services.json app/google-services.json | ||
mv app/.travic-ci/secrets app/.config/secrets.properties | ||
- name: Extract version information to file | ||
run: echo "${{ github.event.client_payload.version }}" > VERSION | ||
|
||
- name: Create version.properties using extracted version | ||
run: | | ||
IFS='.' read -ra VER <<< "$(cat VERSION)" | ||
MAJOR=$((VER[0] * 1000000000)) | ||
MINOR=$((VER[1] * 1000000)) | ||
PATCH=$((VER[2] * 1000)) | ||
CODE=$((MAJOR + MINOR + PATCH)) | ||
echo "version=$(cat VERSION)" > gradle/version.properties | ||
echo "code=$CODE" >> gradle/version.properties | ||
echo "name=v$(cat VERSION)" >> gradle/version.properties | ||
- name: Clean up version information file | ||
run: rm VERSION | ||
|
||
- name: Preview created version.properties | ||
run: cat gradle/version.properties | ||
|
||
- name: Generate version.json | ||
run: ./gradlew generateVersions | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
signoff: true | ||
delete-branch: true | ||
commit-message: "automation: update version.properties" | ||
author: "Author <actions@github.com>" | ||
title: "platform: automated version update" | ||
body: | | ||
This PR was automatically generated to update version.properties. | ||
branch: ${{ github.event.inputs.branchName }} | ||
base: develop | ||
This PR was automatically generated to update `version.properties` | ||
branch: platform/update-version-meta-data | ||
labels: "skip-changelog" | ||
assignees: "wax911" | ||
reviewers: "wax911" |