Update Chat Version #52
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: 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 "builder+skip-ci@codota.com" | |
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 |