2024-12-07 15:27:50 +00:00
|
|
|
name: Update Commit Hash File
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
update-commit:
|
2024-12-13 12:19:46 +00:00
|
|
|
if: contains(github.event.head_commit.message, '#release') != true
|
2024-12-07 15:27:50 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout the code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Get the latest commit hash
|
|
|
|
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
|
|
|
|
2024-12-15 20:24:24 +00:00
|
|
|
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: '20'
|
|
|
|
|
|
|
|
|
2024-12-07 15:27:50 +00:00
|
|
|
- name: Update commit file
|
|
|
|
run: |
|
2024-12-15 20:24:24 +00:00
|
|
|
echo CURRENT_VERSION=$(node -p "require('./package.json').version") >> $GITHUB_ENV
|
|
|
|
echo "{ \"commit\": \"$COMMIT_HASH\" , \"version\": \"$CURRENT_VERSION\" }" > app/commit.json
|
2024-12-07 15:27:50 +00:00
|
|
|
|
|
|
|
- name: Commit and push the update
|
|
|
|
run: |
|
|
|
|
git config --global user.name "github-actions[bot]"
|
|
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
2024-12-07 15:53:33 +00:00
|
|
|
git add app/commit.json
|
2024-12-07 15:27:50 +00:00
|
|
|
git commit -m "chore: update commit hash to $COMMIT_HASH"
|
|
|
|
git push
|