-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh actions: add automated version bumper
- Loading branch information
1 parent
288b619
commit 7ba65a1
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,49 @@ jobs: | |
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update Chart AppVersion | ||
env: | ||
ACTION_TRIGGER: ${{github.event_name}} | ||
run: | | ||
CHART_PATH="charts/sogo/Chart.yaml" | ||
# Update chart version | ||
# Extract the current version from the file | ||
CURRENT_VERSION=$(grep -Eo 'version: [0-9]+\.[0-9]+\.[0-9]+' "$CHART_PATH" | awk '{print $2}') | ||
# If no version is found, exit with an error | ||
if [ -z "$CURRENT_VERSION" ]; then | ||
echo "No version found in the file!" | ||
exit 0 | ||
fi | ||
# Split the version into major, minor, and patch | ||
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION" | ||
MAJOR=${VERSION_PARTS[0]} | ||
MINOR=${VERSION_PARTS[1]} | ||
PATCH=${VERSION_PARTS[2]} | ||
if [ "$ACTION_TRIGGER" = "workflow_dispatch" ]; then | ||
# Increment the version | ||
PATCH=$((PATCH + 1)) | ||
else | ||
MINOR=$((MINOR + 1)) | ||
fi | ||
# Form the new version | ||
NEW_VERSION="$MAJOR.$MINOR.$PATCH" | ||
# Update the file with the new version | ||
sed -i 's/version: '"$CURRENT_VERSION"'/version: '"$NEW_VERSION"'/' "$CHART_PATH" | ||
- name: Commit files and push it | ||
run: | | ||
git add . | ||
git commit -m "chore: bump chart version" | ||
git push | ||
# See https://github.com/helm/chart-releaser-action/issues/6 | ||
- name: Set up Helm | ||
uses: azure/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,11 @@ jobs: | |
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Docker - GHCR Login | ||
uses: docker/login-action@v3 | ||
with: | ||
|
@@ -115,6 +120,22 @@ jobs: | |
generate_release_notes: true | ||
body: | | ||
SOGo Update: https://github.com/Alinto/sogo/releases/tag/SOGo-${{ needs.check_versions.outputs.base_version }} | ||
- name: Update Chart AppVersion | ||
env: | ||
APP_VERSION: ${{needs.check_versions.outputs.base_version}} | ||
DOCKER_REVISION: ${{needs.check_versions.outputs.next_revision}} | ||
run: | | ||
CHART_PATH="charts/sogo/Chart.yaml" | ||
sed -i 's|sonroyaalmerol/docker-sogo:[^ ]*|sonroyaalmerol/docker-sogo:'"$APP_VERSION"'-'"$DOCKER_REVISION"'|g' "$CHART_PATH" | ||
sed -i 's/^appVersion:.*$/appVersion: '"$APP_VERSION"'/' "$CHART_PATH" | ||
- name: Commit files and push it | ||
run: | | ||
git add . | ||
git commit -m "chore: bump container versions in chart" | ||
git push | ||
release_helm: | ||
needs: release | ||
|