Skip to content

Commit

Permalink
split workflows into PR and bump tags on merge to main
Browse files Browse the repository at this point in the history
  • Loading branch information
adityamaru committed Oct 4, 2024
1 parent 86f7568 commit 1366439
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 24 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/bump-cache-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,16 @@ jobs:
id: git-check
run: |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
- name: Commit and push changes
- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
git config user.name adityamaru
git config user.email adityamaru@gmail.com
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git checkout -b bump-cache-version-${{ github.event.inputs.cache_version }}
git add .
git commit -m "Bump @actions/cache version to ${{ github.event.inputs.cache_version }}"
git push origin master
- name: Update v2, v2.0.1, and v2.0.2 tags
if: steps.git-check.outputs.changes == 'true'
run: |
git fetch --all --tags
git tag -fa v2 -m "Update v2 tag to latest commit"
git tag -fa v2.0.1 -m "Update v2.0.1 tag to latest commit"
git tag -fa v2.0.2 -m "Update v2.0.2 tag to latest commit"
git push origin v2 v2.0.1 v2.0.2 --force
- name: Send Slack notification on success
if: steps.git-check.outputs.changes == 'true'
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Bumped setup-ruby v2,v2.0.1, and v2.0.2 to the HEAD of master that points to ${{ github.event.inputs.cache_version }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.CACHE_SLACK_WEBHOOK_URL }}
git push origin bump-cache-version-${{ github.event.inputs.cache_version }}
gh pr create --title "Bump @actions/cache version to ${{ github.event.inputs.cache_version }}" --body "This PR updates the @actions/cache version to ${{ github.event.inputs.cache_version }}"
34 changes: 34 additions & 0 deletions .github/workflows/bump-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Bump Tags on Main

on:
push:
branches:
- main

jobs:
bump-tags:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Update v2, v2.0.1, and v2.0.2 tags
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git tag -fa v2 -m "Update v2 tag to latest commit on main"
git tag -fa v2.0.1 -m "Update v2.0.1 tag to latest commit on main"
git tag -fa v2.0.2 -m "Update v2.0.2 tag to latest commit on main"
git push origin v2 v2.0.1 v2.0.2 --force
- name: Send Slack notification on success
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Updated setup-ruby v2, v2.0.1, and v2.0.2 tags to the latest commit on main"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.CACHE_SLACK_WEBHOOK_URL }}

0 comments on commit 1366439

Please sign in to comment.