Skip to content

Commit a63069b

Browse files
committed
feat: add faster cache refresh
1 parent 79b9ebd commit a63069b

File tree

2 files changed

+20
-42
lines changed

2 files changed

+20
-42
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,33 @@
11
# .github/workflows/ci.yml
2-
name: CI (Auto-tag + Build & Push Docker on SemVer)
2+
name: CI (Auto-tag on main + Push Docker on SemVer tag)
33

44
on:
55
push:
6-
branches: [ "main" ] # main pushes can create a tag (no image push)
7-
tags: [ "v*.*.*", "*.*.*" ] # tag pushes build & push the SemVer image
6+
branches: [ "main" ] # main push -> create next tag (no Docker push)
7+
tags: [ "v*.*.*", "*.*.*" ] # tag push -> build & push the SemVer image
88
workflow_dispatch: {}
99

1010
env:
1111
REGISTRY: docker.io
1212
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/gabs-redis-langcache
1313
DOCKERFILE: ./Dockerfile
1414

15-
# We need write so the job can create a tag via GitHub API
15+
# Needed so GITHUB_TOKEN can create tags
1616
permissions:
1717
contents: write
1818

1919
jobs:
20-
# 1) MAIN PUSH: if any commit message includes #release, create next SemVer tag (no Docker build here)
21-
auto-release:
20+
# 1) MAIN: always bump & create next patch tag. NO Docker build here.
21+
auto-tag:
2222
if: ${{ github.ref == 'refs/heads/main' }}
2323
runs-on: ubuntu-latest
2424
steps:
25-
- name: Checkout (full history for tags)
25+
- name: Checkout (full history)
2626
uses: actions/checkout@v4
2727
with:
2828
fetch-depth: 0
2929

30-
- name: Decide if this push requests a release
31-
id: decide
32-
run: |
33-
MSGS="${{ join(github.event.commits.*.message, ' | ') }}"
34-
echo "Commit messages: $MSGS"
35-
if echo "$MSGS" | grep -q '#release'; then
36-
echo "release=yes" >> $GITHUB_OUTPUT
37-
else
38-
echo "release=no" >> $GITHUB_OUTPUT
39-
fi
40-
41-
- name: Compute next patch tag (vX.Y.Z -> vX.Y.(Z+1))
42-
id: bump
43-
if: steps.decide.outputs.release == 'yes'
30+
- name: Bump patch and create tag
4431
shell: bash
4532
run: |
4633
set -e
@@ -49,28 +36,19 @@ jobs:
4936
VER=${LAST#v}
5037
IFS='.' read -r MA MI PA <<<"$VER"
5138
NEW_TAG="v$MA.$MI.$((PA+1))"
52-
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
53-
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
54-
echo "Last tag: $LAST -> Next tag: $NEW_TAG"
39+
echo "Last: $LAST -> New: $NEW_TAG"
5540
56-
- name: Create git tag via GitHub API
57-
if: steps.decide.outputs.release == 'yes'
58-
uses: actions/github-script@v7
59-
with:
60-
script: |
61-
const newTag = process.env.NEW_TAG; // from $GITHUB_ENV
62-
core.info(`Creating tag ${newTag} at ${context.sha}`);
63-
await github.rest.git.createRef({
64-
owner: context.repo.owner,
65-
repo: context.repo.repo,
66-
ref: `refs/tags/${newTag}`,
67-
sha: context.sha
68-
});
69-
env:
70-
NEW_TAG: ${{ env.NEW_TAG }}
41+
git config user.name "github-actions[bot]"
42+
git config user.email "github-actions[bot]@users.noreply.github.com"
43+
44+
# Create annotated tag on the pushed commit (HEAD of main)
45+
git tag -a "$NEW_TAG" -m "release $NEW_TAG"
46+
47+
# Push tag using GITHUB_TOKEN (requires 'contents: write' + repo setting 'Read and write')
48+
git push origin "$NEW_TAG"
7149
72-
# 2) TAG PUSH: ONLY build & push the SemVer image
73-
build-and-push:
50+
# 2) TAG: ONLY build & push the SemVer image to Docker Hub.
51+
push-image:
7452
if: startsWith(github.ref, 'refs/tags/')
7553
runs-on: ubuntu-latest
7654
steps:

main_demo_released.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def calc_savings(tokens_est: int, price_in: float, price_out: float, frac_in: fl
595595
<div class="app-header">
596596
<div class="brand">
597597
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Redis_logo.svg/2560px-Redis_logo.svg.png" alt="Redis">
598-
<div class="title">Redis LangCache — Demo PT-BR - SemVer: v2.0.9-harness - PR GitHub: gacerioni</div>
598+
<div class="title">Redis LangCache — Demo PT-BR - SemVer: v2.0.10-harness - PR GitHub: gacerioni</div>
599599
</div>
600600
<div class="links">
601601
<a href="https://www.linkedin.com/in/gabrielcerioni/" target="_blank" rel="noopener">💼 LinkedIn do Gabs</a>

0 commit comments

Comments
 (0)