Skip to content

Commit 7f475fe

Browse files
ci(action, PVQ-5086): Moving from PAT into Github App for updating versions list.
1 parent 9dff16e commit 7f475fe

2 files changed

Lines changed: 34 additions & 13 deletions

File tree

.github/workflows/maven-release.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,25 @@ jobs:
9191
- name: Prepare directory for versions repository
9292
run: mkdir -p pdfix-version-updates
9393

94-
- name: Checkout versions repository
95-
uses: actions/checkout@v4
96-
with:
97-
repository: pdfix/pdfix-version-updates
98-
path: pdfix-version-updates
99-
token: ${{ secrets.PAT_VERSIONS }}
100-
ref: main
101-
fetch-depth: 0
94+
- name: Generate GitHub App token
95+
id: app-token
96+
# v2.2.2 last stable version pinned by sha commit to avoid what happened to Lite LLM
97+
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349
98+
with:
99+
app-id: ${{ secrets.APP_ID }}
100+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
101+
owner: pdfix
102+
repositories: pdfix-version-updates
103+
104+
- name: Checkout versions repo
105+
uses: actions/checkout@v4
106+
with:
107+
repository: pdfix/pdfix-version-updates
108+
path: pdfix-version-updates
109+
token: ${{ steps.app-token.outputs.token }}
110+
ref: main
111+
fetch-depth: 0
112+
fetch-tags: true
102113

103114
- name: Update versions repository with new version
104115
run: chmod +x update_versions_repository.sh && ./update_versions_repository.sh ${{ env.ACTION_NAMESPACE }} ${{ env.ACTION_REPOSITORY }} ${{ env.tag }}

update_versions_repository.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,28 @@ if jq -e --arg name "$DOCKER_NAME" '.["pdfix-actions"][] | select(.name == $name
4141
git push
4242

4343
# Step 4: Tag latest commit with increment
44+
git fetch --tags
4445
git pull
46+
4547
if git describe --exact-match --tags HEAD > /dev/null 2>&1; then
4648
echo "HEAD already has a tag — skipping tagging."
4749
else
4850
LATEST_TAG=$(git tag -l "v*.*.*" | sort -V | tail -n 1)
49-
echo "Latest tag is: $LATEST_TAG"
50-
VERSION=${LATEST_TAG#v}
51-
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
52-
PATCH=$((PATCH + 1))
53-
NEW_TAG="v$MAJOR.$MINOR.$PATCH"
51+
52+
if [ -z "$LATEST_TAG" ]; then
53+
echo "No existing tags found, starting from v0.0.1"
54+
NEW_TAG="v0.0.1"
55+
else
56+
echo "Latest tag is: $LATEST_TAG"
57+
VERSION=${LATEST_TAG#v}
58+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
59+
PATCH=$((PATCH + 1))
60+
NEW_TAG="v$MAJOR.$MINOR.$PATCH"
61+
fi
62+
5463
git tag -a "$NEW_TAG" -m "Release $NEW_TAG"
5564
git push origin "$NEW_TAG"
65+
5666
echo "Tagged HEAD with: $NEW_TAG"
5767
fi
5868

0 commit comments

Comments
 (0)