Skip to content

Update Chat Version #19

Update Chat Version

Update Chat Version #19

name: Update Chat Version
on:
workflow_dispatch:
inputs:
version:
description: 'Chat Version (example: "v1.2.3")'
required: false
jobs:
update-chat-version:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_BUILDER_TOKEN }}
- name: Setup git
run: |
set -ex
git config --global user.email "[email protected]"
git config --global user.name "codota-builder"
- name: Get latest release version
id: get_version
run: |
if [ -z "${{ inputs.version }}" ]; then
latest_version=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/codota/tabnine-chat-app/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
echo "::set-output name=version::${latest_version}"
else
echo "::set-output name=version::${{ inputs.version }}"
fi
- name: Set Chat Version
run: echo "${{ steps.get_version.outputs.version }}" > .chatversion
- name: Commit Change
run: |
git add .chatversion
git diff --quiet && git diff --staged --quiet || git commit -m "Chat version updated to ${{ github.event.inputs.version }}"
git push