11 Commits

Author SHA1 Message Date
ludal
0814d09ba2 chore(varnish): update version to 1.6.1 2026-02-09 18:19:34 +00:00
Ludovic Cartier
80fb9c64de update varnish build
All checks were successful
/ validate (push) Successful in 5s
/ build (push) Successful in 45s
2026-02-09 19:19:46 +01:00
ludal
c033b9b79b gitea-actions auto commit - update version 2025-07-22 15:36:41 +00:00
Ludovic Cartier
7e288531dd update package name
All checks were successful
/ validate (push) Successful in 18s
/ build (push) Successful in 22s
2025-07-22 17:36:26 +02:00
ludal
96410e4792 gitea-actions auto commit - update version 2025-07-21 22:04:37 +00:00
Ludovic Cartier
e4f3ed8007 update notification message & re-enable version check
All checks were successful
/ validate (push) Successful in 4s
/ build (push) Successful in 21s
2025-07-22 00:04:34 +02:00
Ludovic Cartier
77af792e82 gros teubé
All checks were successful
/ validate (push) Successful in 4s
/ build (push) Successful in 27s
2025-07-21 23:55:46 +02:00
Ludovic Cartier
11e8cd20d0 revert
Some checks failed
/ validate (push) Successful in 4s
/ build (push) Failing after 15s
2025-07-21 23:53:30 +02:00
Ludovic Cartier
6d16aa2187 orders matters
Some checks failed
/ validate (push) Successful in 4s
/ build (push) Failing after 16s
2025-07-21 23:51:35 +02:00
Ludovic Cartier
66091c5230 env.version
Some checks failed
/ validate (push) Successful in 4s
/ build (push) Failing after 17s
2025-07-21 23:48:22 +02:00
Ludovic Cartier
6dba21d352 force build
Some checks failed
/ validate (push) Successful in 3s
/ build (push) Failing after 15s
2025-07-21 23:40:47 +02:00
2 changed files with 49 additions and 31 deletions

View File

@@ -11,55 +11,77 @@ jobs:
validate:
runs-on: ubuntu-latest
outputs:
build: ${{ steps.new_version.outputs.build }}
version: ${{ steps.new_version.outputs.version }}
build: ${{ steps.check_version.outputs.build }}
version: ${{ steps.check_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Get latest release version
id: new_version
- name: Check for latest release version
id: check_version
run: |
CURRENT=`cat .version`
LATEST=`curl --silent https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/releases/latest | jq -r .tag_name | sed "s/v//"`
echo "current registered version: $CURRENT"
echo "latest version on remote repo: $LATEST"
if awk "BEGIN {exit !($LATEST > $CURRENT)}"; then
echo $LATEST > .version
# Define version file specific to this exporter
VERSION_FILE=".varnish-exporter.version"
# Initialize if missing
if [ ! -f "$VERSION_FILE" ]; then echo "0.0.0" > "$VERSION_FILE"; fi
CURRENT=$(cat "$VERSION_FILE")
# Get latest tag. Fail silently on curl error, verify json output
LATEST=$(curl --silent --fail https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/releases/latest | jq -r .tag_name | sed "s/^v//")
if [ -z "$LATEST" ] || [ "$LATEST" = "null" ]; then
echo "::error::Failed to fetch latest version from GitHub"
exit 1
fi
echo "Current local version: $CURRENT"
echo "Latest remote version: $LATEST"
# Version comparison using sort -V (Handles 1.10 > 1.9 correctly)
if [ "$CURRENT" != "$LATEST" ]; then
# Sort the two versions and take the last one (the highest)
NEWER=$(printf "%s\n%s" "$CURRENT" "$LATEST" | sort -V | tail -n1)
if [ "$NEWER" = "$LATEST" ]; then
echo "New version detected: $LATEST"
echo "$LATEST" > "$VERSION_FILE"
echo "build=true" >> $GITHUB_OUTPUT
echo "version=$LATEST" >> $GITHUB_OUTPUT
echo "VERSION=$LATEST" >> $GITHUB_ENV
else
echo "Remote version ($LATEST) is not newer than local ($CURRENT). Skipping."
echo "build=false" >> $GITHUB_OUTPUT
fi
else
echo "Up to date."
echo "build=false" >> $GITHUB_OUTPUT
fi
echo "VERSION=`cat .version`" >> $GITHUB_ENV
- uses: stefanzweifel/git-auto-commit-action@v6
with:
branch: main
file_pattern: '.version'
file_pattern: '.varnish-exporter.version'
commit_user_name: gitea-actions[bot]
commit_user_email: no-reply@brainsys.io
commit_message: gitea-actions auto commit - update version
tagging_message: '${{ env.VERSION }}'
commit_message: "chore(varnish): update version to ${{ env.VERSION }}"
tagging_message: 'varnish-v${{ env.VERSION }}'
push_options: '--force'
- name: DEBUG - build value
run: echo "${{ steps.new_version.outputs.build }}"
- name: DEBUG - version value
run: echo "${{ steps.new_version.outputs.version }}"
run: echo "${{ steps.check_version.outputs.build }}"
build:
needs: validate
if: needs.validate.outputs.build == 'true'
timeout-minutes: 2
#timeout-minutes: 2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set version to env vars
run: |
echo "${{ needs.validate.outputs.version }}"
echo "VERSION=${{ needs.validate.outputs.version }}" >> $GITHUB_ENV
echo "version: $VERSION"
- name: Setup go
uses: actions/setup-go@v4
@@ -84,7 +106,7 @@ jobs:
- name: Prepare amd64 control file
run: |
echo "Package: varnish-exporter" > varnish-exporter-amd64/DEBIAN/control
echo "Package: prometheus-varnish-exporter" > varnish-exporter-amd64/DEBIAN/control
echo "Version: $VERSION" >> varnish-exporter-amd64/DEBIAN/control
echo "Maintainer: Ludovic Cartier <ludovic.cartier@alterway.fr>" >> varnish-exporter-amd64/DEBIAN/control
echo "Architecture: amd64" >> varnish-exporter-amd64/DEBIAN/control
@@ -95,10 +117,6 @@ jobs:
run: |
dpkg -b varnish-exporter-amd64 bin/prometheus-varnish-exporter_$VERSION-1_amd64.deb
# - name: Prepare apt repo upload
# run: |
# mv bin/prometheus-varnish-exporter-amd64.deb bin/prometheus-varnish-exporter_$VERSION-1_amd64.deb
- name: Release packages
run: |
curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file bin/prometheus-varnish-exporter_$VERSION-1_amd64.deb \
@@ -107,7 +125,7 @@ jobs:
- name: Create release
uses: akkuman/gitea-release-action@v1
with:
tag_name: "$VERSION"
tag_name: "${{ env.VERSION }}"
files: |-
bin/**
token: "${{ secrets.RELEASE_TOKEN }}"
@@ -115,8 +133,8 @@ jobs:
- name: Send notification to mattermost
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
SLACK_WEBHOOK: "${{ secrets.MATTERMOST_WEBHOOK }}"
SLACK_USERNAME: gitea-bot
SLACK_CHANNEL: gitea-actions
SLACK_COLOR: ${{ job.status }}
SLACK_CUSTOM_PAYLOAD: '{"username": "gitea-bot", "icon_url": "https://w7.pngwing.com/pngs/940/571/png-transparent-gitea-hd-logo-thumbnail.png", "text": "varnish-exporter build has just finished in version $VERSION !"}'
SLACK_COLOR: "${{ job.status }}"
SLACK_CUSTOM_PAYLOAD: '{"username": "gitea-bot", "icon_url": "https://w7.pngwing.com/pngs/940/571/png-transparent-gitea-hd-logo-thumbnail.png", "text": "varnish-exporter build has just finished in version ${{ env.VERSION }} !"}'