Sync tdengine latest version #191
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: Sync tdengine latest version | |
on: | |
schedule: | |
- cron: '30 2 * * *' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get Latest Tag | |
id: get_latest_tag | |
run: | | |
TAG=$(curl -s "https://api.github.com/repos/taosdata/TDengine/releases/latest" | jq -r '.tag_name' | sed -e 's/ver-//g') | |
echo "Latest tag: $TAG" | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
- name: Check if tag changed | |
id: check_tag_change | |
run: | | |
LAST_TAG=$(cat LATEST_VERSION) | |
echo "Last tag: $LAST_TAG" | |
echo "tag_changed=$(test $LAST_TAG != ${{ steps.get_latest_tag.outputs.tag }} && echo true || echo false)" >> $GITHUB_OUTPUT | |
- name: Update version on Tag Change | |
if: steps.check_tag_change.outputs.tag_changed == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "${{ steps.get_latest_tag.outputs.tag }}" > LATEST_VERSION | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -am "feat: bump version@${{ steps.get_latest_tag.outputs.tag }}" | |
git tag v${{ steps.get_latest_tag.outputs.tag }} | |
git push | |
git push --tags | |
- name: Trigger docker build | |
if: steps.check_tag_change.outputs.tag_changed == 'true' | |
run: | | |
REPO_OWNER=enix223 | |
REPO_NAME=tdengine-openjdk-client | |
TRIGGER_WORKFLOW_ID=main.yml | |
response=$(curl -X POST \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
-H "Authorization: Bearer ${{ secrets.REPO_SCOPED_TOKEN }}" \ | |
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/workflows/$TRIGGER_WORKFLOW_ID/dispatches" \ | |
-d '{"ref":"main"}') | |
echo $response |