Skip to content

Update Snap on new releases of its source #3892

Update Snap on new releases of its source

Update Snap on new releases of its source #3892

Workflow file for this run

name: Update Snap on new releases of its source
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
- cron: '0 0,4,8,12,16,20 * * *'
permissions:
contents: write
pull-requests: write
jobs:
check-version:
name: Detect new releases
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo snap install yq
- id: latest-release
uses: pozetroninc/[email protected]
with:
repository: grafana/agent
excludes: prerelease, draft
- name: Checkout the Snap source
uses: actions/checkout@v3
with:
path: main
- id: check
name: Check for new releases
shell: bash
run: |
release=$(yq '.parts.grafana-agent["source-tag"]' $GITHUB_WORKSPACE/main/snap/snapcraft.yaml)
if [ "${release}" != "${{steps.latest-release.outputs.release}}" ]; then
echo "release=${{steps.latest-release.outputs.release}}" >> $GITHUB_OUTPUT
echo "New upstream release ${{steps.latest-release.outputs.release}} found"
else
echo "No new upstream release found"
fi
- name: Update the application version
if: ${{ steps.check.outputs.release != '' }}
shell: bash
run: |
source_tag="${{ steps.check.outputs.release }}" \
version=${source_tag#"v"} \
yq -i '.version = strenv(version) | .parts.grafana-agent["source-tag"] = strenv(source_tag)' $GITHUB_WORKSPACE/main/snap/snapcraft.yaml
- name: Create a PR
if: ${{ steps.check.outputs.release != '' }}
uses: peter-evans/[email protected]
with:
path: main
token: ${{ secrets.OBSERVABILITY_NOCTUA_TOKEN }}
commit-message: "chore(deps): bump grafana-agent version to ${{ steps.check.outputs.release }}"
committer: "Github Actions <[email protected]>"
author: "Github Actions <[email protected]>"
title: "Update to grafana-agent ${{ steps.check.outputs.release }}"
body: Automated update to follow upstream [release](https://github.com/grafana/agent/releases/tag/${{ steps.check.outputs.release }}) of grafana-agent.
branch: "chore/bump-version-to-${{ steps.check.outputs.release }}"
delete-branch: true