server-update #11
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 is a basic workflow to help you get started with Actions | |
name: Update README with latest flutter server version | |
# Controls when the workflow will run | |
on: | |
repository_dispatch: | |
types: [server-update] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Update README with latest commit id and push to repo | |
run: | | |
npm install -g mustache | |
touch data.json | |
echo "{\"SERVER_VERSION\": \"${{ github.event.client_payload.version }}\"}" > data.json | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git status | |
BRANCH_NAME=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | |
git pull --rebase origin main | |
git checkout -b run-test-upstream-${{ github.event.client_payload.version }} | |
git pull --rebase origin main | |
cat data.json | |
mustache data.json template.mustache > README_new.md | |
mv README_new.md README.md | |
rm -rf data.json | |
git add README.md | |
git commit -m "Update README with latest commit ID - ${{ github.event.client_payload.version }}" | |
git push -u origin run-test-upstream-${{ github.event.client_payload.version }} | |
gh pr create --title "Update server version in ReadMe" --body "Test driver with latest server version" | |
env: | |
GITHUB_TOKEN: ${{ secrets.UPDATE_TOKEN }} |