Get latest release version #2
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: Get latest release version | |
on: | |
schedule: | |
- cron: '0 11 * * *' | |
workflow_dispatch: | |
inputs: | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.11' | |
- name: Install dependencies | |
run: npm install | |
- name: Fetch release version | |
run: npm run get-version | |
- name: Store Version number in env | |
run: | | |
echo "version=$(cat release-version)" >> $GITHUB_ENV | |
- name: Check for modified files | |
id: git-check | |
run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") | |
- name: Commit latest release version | |
if: steps.git-check.outputs.modified == 'true' | |
uses: actions-js/push@v1.4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |