Poll (dev/rc-branch) from official repo to get the latest release version #9801
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: Poll (dev/rc-branch) from official repo to get the latest release version | |
on: | |
schedule: | |
- cron: '58 0 * * *' | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch branch name of latest version | |
run: | | |
curl -sL https://api.github.com/repos/meilisearch/MeiliSearch/releases | \ | |
jq -r "map(select(.prerelease)) | first | .tag_name" > /tmp/meilisearch-latest-branch-name | |
echo "REMOTE_BRANCH_NAME=$(cat /tmp/meilisearch-latest-branch-name)" >> $GITHUB_ENV | |
curl -sL https://github.com/patrickdung/MeiliSearch-crossbuild/raw/dev/release-versions/meilisearch-latest.txt -o /tmp/meilisearch-local-branch-name | |
echo "LOCAL_BRANCH_NAME=$(cat /tmp/meilisearch-local-branch-name)" >> $GITHUB_ENV | |
if [ $(cat /tmp/meilisearch-latest-branch-name) == "null" ] || [ $(cat /tmp/meilisearch-latest-branch-name) == null ] || [ $(cat /tmp/meilisearch-latest-branch-name) == "" ] || [ -z /tmp/meilisearch-latest-branch-name ] ; then exit 1 ; else echo "Remote Branch Name is not null"; fi | |
- name: Check for modified files | |
id: git-check | |
run: | | |
echo ::set-output name=modified::$( if [ "${{ env.REMOTE_BRANCH_NAME}}" != "null" ] && [ "${{ env.REMOTE_BRANCH_NAME }}" != "${{ env.LOCAL_BRANCH_NAME }}" ]; then echo "true"; else echo "false"; fi ) | |
- uses: actions/checkout@v2 | |
with: | |
ref: dev | |
# https://github.heygears.community/t/push-from-action-even-with-pat-does-not-trigger-action/17622/5 | |
persist-credentials: false | |
- name: Commit latest release version | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'Patrick Dung' | |
git config --global user.email '38665827+patrickdung@users.noreply.github.com' | |
#git branch ${{ env.REMOTE_BRANCH_NAME }} | |
#git switch ${{ env.REMOTE_BRANCH_NAME }} | |
git switch dev | |
echo ${{ env.REMOTE_BRANCH_NAME }} > release-versions/meilisearch-latest.txt | |
git commit -am "New release version ${{ env.REMOTE_BRANCH_NAME }}" | |
## by default GH actions push cannot trigger another GH action | |
##git push | |
- name: Push changes | |
if: steps.git-check.outputs.modified == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
repository: patrickdung/MeiliSearch-crossbuild | |
github_token: ${{ secrets.PUBLISH_TOKEN }} | |
branch: dev |