Skip to content

Commit

Permalink
chore(ci): add workflow for checking for latest version (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl authored Oct 7, 2024
1 parent bee8ce0 commit 7cda9dd
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/update-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Check/update to latest version

on:
schedule:
# Ru every day at 7:15
- cron: 15 7 * * *
workflow_dispatch:

jobs:
build:
name: Check latest version
runs-on: ubuntu-latest

steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ripgrep
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.SUBLIMELSP_APP_ID }}
private-key: ${{ secrets.SUBLIMELSP_APP_PRIVATE_KEY }}

- name: Get latest release of the server
uses: pozetroninc/[email protected]
id: latest_release
with:
excludes: 'prerelease,draft'
repository: 'artempyanykh/marksman'
token: ${{ steps.app-token.outputs.token }}

- uses: actions/checkout@v4
with:
ref: main

- name: Get current TAG from main
id: current_release
run: |
release=$(rg -o 'MARKSMAN_TAG = '([^']+)' -r \$1 "plugin.py")
echo "release=$release" >> "$GITHUB_OUTPUT"
- if: steps.current_release.outputs.release != steps.latest_release.outputs.release
name: Update current version
run: sed -i 's/${{ steps.current_release.outputs.release }}/${{ steps.latest_release.outputs.release }}/' plugin.py

- if: steps.current_release.outputs.release != steps.latest_release.outputs.release
name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
commit-message: update marksman to ${{ steps.latest_release.outputs.release }}
delete-branch: true
title: update marksman to ${{ steps.latest_release.outputs.release }}
body: 'Update marksman from [${{ steps.current_release.outputs.release }}](https://github.com/artempyanykh/marksman/releases/tag/${{ steps.current_release.outputs.release }}) to [${{ steps.latest_release.outputs.release }}](https://github.com/artempyanykh/marksman/releases/tag/${{ steps.latest_release.outputs.release }}) (see [all changes](https://github.com/artempyanykh/marksman/compare/${{ steps.current_release.outputs.release }}...${{ steps.latest_release.outputs.release }})).'
token: ${{ steps.app-token.outputs.token }}

0 comments on commit 7cda9dd

Please sign in to comment.