Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andynguyenm/a860d4609c18d1d208266ef17461d949 to your computer and use it in GitHub Desktop.
Save andynguyenm/a860d4609c18d1d208266ef17461d949 to your computer and use it in GitHub Desktop.
Github Action workflow for creating release branch, updating versionName and versionCode, copying strings.xml to another repo, submitting PRs as per GitFlow.
name: Create Release Branch
on:
workflow_dispatch:
inputs:
versionName:
description: 'Name of version (ie 5.5.0)'
required: true
versionCode:
description: 'Version number (50500)'
required: true
jobs:
createrelease:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Create release branch
run: git checkout -b release/v${{ github.event.inputs.versionName }}
- name: Initialize mandatory git config
run: |
git config user.name "GitHub Actions"
git config user.email noreply@github.com
- name: Change version number and name
run: printf 'ext.version_code = ${{ github.event.inputs.versionCode }}\next.version_name = "${{ github.event.inputs.versionName }}"\n' > app_versions.gradle
- name: Update Changelog
uses: thomaseizinger/keep-a-changelog-new-release@v1
with:
version: ${{ github.event.inputs.versionName }}
- name: Commit changelog and manifest files
id: make-commit
run: |
git add app_versions.gradle
git add CHANGELOG.md
git commit --message "Prepare release ${{ github.event.inputs.versionName }}"
echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Push new branch
run: git push origin release/v${{ github.event.inputs.versionName }}
- name: Submit strings.xml for translation
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.ANDROID_I18N_PAT }}
src_path: resources/src/main/res/values/strings.xml
src_branch: release/v${{ github.event.inputs.versionName }}
dst_path: en/strings.xml
dst_owner: your-repo-owner
dst_repo_name: android-i18n
dst_branch: master
clean: true
commit_message: release/v${{ github.event.inputs.versionName }} BOT New Strings for translation submitted.
- name: Create pull request into main
uses: thomaseizinger/create-pull-request@1.0.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
head: release/v${{ github.event.inputs.versionName }}
base: main
title: v${{ github.event.inputs.versionName }} into main
reviewers: ${{ github.event.issue.user.login }}
body: |
Hi!
This PR was created in response workflow running.
I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}.
- name: Create pull request to develop
uses: thomaseizinger/create-pull-request@1.0.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
head: release/v${{ github.event.inputs.versionName }}
base: develop
title: v${{ github.event.inputs.versionName }} into develop
reviewers: ${{ github.event.issue.user.login }}
body: |
Hi!
This PR was created in response workflow running.
I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment