Auto changed version on README.md #34
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
name: Change content in file into another | |
env: | |
GDAP_FILE: 'admob/AdMob.gdap' | |
MD_FILE: 'README.md' | |
on: | |
push: | |
paths: | |
- 'admob/AdMob.gdap' | |
- 'README.md' | |
- '.github/workflows/update_readme_sdk_version.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.ADMOB_ANDROID_WORKFLOW }} | |
- name: Run a one-line script | |
run: | | |
REGEX_FIND_VERSION_GDAP_FILE='(?<=play-services-ads:)(\d+[.]\d+[.]\d+)' | |
REGEX_FIND_VERSION_TO_CHANGE_CONTENT_MD_FILE='(?<=GAD SDK Android-v)(\d+[.]\d+[.]\d+)' | |
GAD_SDK_VERSION=$(cat ${{ env.GDAP_FILE }} | perl -ne 'print $1 if /'$REGEX_FIND_VERSION_GDAP_FILE'/s') | |
perl -pi -e "s/$REGEX_FIND_VERSION_TO_CHANGE_CONTENT_MD_FILE/$GAD_SDK_VERSION/g" ${{ env.MD_FILE }} | |
cat ${{ env.MD_FILE }} | |
- name: Git Auto Commit | |
uses: stefanzweifel/[email protected] | |
with: | |
commit_message: Auto changed version on README.md |