Tag Version #154
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: Tag Version | |
on: | |
schedule: | |
- cron: '41 11 * * 6' # weekly, on Saturday morning (UTC) | |
workflow_dispatch: | |
jobs: | |
has_changes: | |
runs-on: ubuntu-latest | |
name: Check For Changes | |
outputs: | |
shouldRun: ${{ steps.should_run.outputs.shouldRun }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: print latest_commit | |
run: echo ${{ github.sha }} | |
- id: should_run | |
if: ${{ github.event_name == 'schedule' }} | |
name: check that there have been commits since the last tag | |
run: test -z $(git rev-list $(git describe --tags --abbrev=0)..${{ github.sha }} --max-count=1) && echo "shouldRun=no" >> "$GITHUB_OUTPUT" | |
tag: | |
needs: has_changes | |
runs-on: ubuntu-latest | |
if: needs.has_changes.outputs.shouldRun != 'no' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ZORGBORT_TOKEN }} | |
- name: Setup Git | |
run: | | |
git config --global user.name "Zorgbort" | |
git config --global user.email "[email protected]" | |
- name: Increment Version | |
run: npx versionup --level major | |
- run: | | |
NEW_TAG=`node -p "require('./package.json').version"` | |
echo ${NEW_TAG} | |
echo "new_tag=${NEW_TAG}" >> $GITHUB_ENV | |
- name: Tag Version | |
run: | | |
git commit -a -m "${{env.new_tag}}" | |
git tag v${{env.new_tag}} -m "Tagging the v${{env.new_tag}} release" | |
- name: Push Changes | |
run: git push --follow-tags | |
- uses: act10ns/slack@v2 | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ILIOS_DEPLOYMENT_WEBHOOK_URL }} | |
with: | |
status: ${{ job.status }} | |
message: Tagged Zorgbort v${{env.new_tag}} {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }} | |
- uses: act10ns/slack@v2 | |
if: failure() | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ILIOS_DEPLOYMENT_WEBHOOK_URL }} | |
with: | |
status: ${{ job.status }} | |
message: Zorgbort Version Tagging Failed {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }} | |