Skip to content

Bump Cache Version

Bump Cache Version #14

name: Bump Cache Version
on:
workflow_dispatch:
inputs:
cache_version:
description: 'New @useblacksmith/cache version'
required: true
type: string
jobs:
bump-cache-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update package.json
run: |
sed -i 's/"@actions\/cache": "npm:@useblacksmith\/cache@[^"]*"/"@actions\/cache": "npm:@useblacksmith\/cache@${{ github.event.inputs.cache_version }}"/' package.json
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Check for changes
id: git-check
run: |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
- name: Commit and push changes
if: steps.git-check.outputs.changes == 'true'
run: |
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "Bump @actions/cache version to ${{ github.event.inputs.cache_version }}"
git push origin main
- name: Update v1 tag
if: steps.git-check.outputs.changes == 'true'
run: |
git fetch --all --tags
git tag -fa v1 -m "Update v1 tag to latest commit"
git push origin v1 --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-bazel v1 to the HEAD of main that points to ${{ github.event.inputs.cache_version }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.CACHE_SLACK_WEBHOOK_URL }}