Skip to content

Check for new version of Telegraf #193

Check for new version of Telegraf

Check for new version of Telegraf #193

Workflow file for this run

name: Check for new version of Telegraf
# Controls when the workflow will run
on:
schedule:
# * is a special character in YAML so you have to quote this string
# Checking on workdays
- cron: '0 1 * * 1-5'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
check:
name: Check current Telegraf version
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: write
repository-projects: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- id: version
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: influxdata
repo: telegraf
excludes: prerelease, draft
- name: printoutput
run: |
echo ${{ steps.version.outputs.release }}
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out the repo
uses: actions/checkout@v4
with:
# use deploy key to trigger further actions (push on tag)
# use PAT as GA won't trigger if using the default GA token
token: "${{ secrets.REPO_AUTOMATED_PUSH_TOKEN }}"
# Runs a set of commands using the runners shell
- id: setversion
run: |
SHORTVERSION=$(echo ${{steps.version.outputs.release}} | cut -c 2-)
echo ${{steps.version.outputs.release}} > version.txt
cat version.txt
# echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")
if [[ $([ -z "`git status --porcelain`" ] && echo "false" || echo "true") == "true" ]]; then
cp Dockerfile Dockerfile.old
echo "FROM telegraf:$SHORTVERSION" > Dockerfile
cat Dockerfile.old |tail -n+2>> Dockerfile
git config --global user.name 'githubaction'
git config --global user.email '1276544+vincejv@users.noreply.github.com'
git add version.txt
git add Dockerfile
git commit -am "automated bump version to ${{steps.version.outputs.release}}"
git tag -a -m "automated version bump" $SHORTVERSION
git push origin --atomic --follow-tags
echo "new version pushed"
fi
exit 0