Skip to content

Commit

Permalink
ci: trigger cache refreshes via cron
Browse files Browse the repository at this point in the history
  • Loading branch information
rarescosma committed Sep 26, 2024
1 parent 49702a3 commit 7529911
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- ci
- "dev/build-yml"
- "!main"

permissions:
Expand Down Expand Up @@ -125,7 +126,7 @@ jobs:
echo "ASSET_SUM=$ARCHIVE.tar.gz.sha256" >> $GITHUB_ENV
- name: Upload release archive
if: github.ref == 'refs/heads/ci'
if: "github.ref == 'refs/heads/ci' && !contains(github.event.head_commit.message, '[cron]')"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
Expand All @@ -134,7 +135,7 @@ jobs:
gh release upload "$version" ${{ env.ASSET }} ${{ env.ASSET_SUM }}
promote-release:
if: github.ref == 'refs/heads/ci'
if: "github.ref == 'refs/heads/ci' && !contains(github.event.head_commit.message, '[cron]')"
name: promote-release
needs: ["build-binaries", "get-version"]
runs-on: ubuntu-latest
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/cron-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: cron-cache

on:
push:
branches:
- "dev/cron-cache-yml"
schedule:
- cron: "0 0 */5 * *"

permissions:
contents: write

jobs:
create-release:
name: trigger-cron-ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_TOKEN }}
- name: Push a special commit to the CI branch
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
shell: bash
run: |
ts="$(date "+%F@%T")"
git config --global user.name 'Github Actions'
git config --global user.email 'gh@getbetter.ro'
git branch -D ci-temp || true
git checkout -b ci-temp
git commit --allow-empty --message="[cron] $ts"
git push -u origin ci-temp:ci --force

0 comments on commit 7529911

Please sign in to comment.