Skip to content

Upgrade flux

Upgrade flux #1626

Workflow file for this run

name: Upgrade flux
on:
workflow_dispatch:
schedule:
- cron: "0 10 * * *"
permissions:
contents: read # for actions/checkout to fetch code
jobs:
has-new-flux:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set new version if different
id: version
run: |
old_version="$(grep '^FLUX_VERSION=' Makefile | cut -d'=' -f2)"
new_version="$(curl -s --request GET --url "https://api.github.com/repos/fluxcd/flux2/releases?per_page=1" | jq . | jq '.[0] | .tag_name' | jq -r | sed -e 's/v//')"
if [[ "$old_version" != "$new_version" ]]; then
echo "::set-output name=version::$new_version"
fi
upgrade-flux:
needs:
- has-new-flux
runs-on: ubuntu-latest
if: needs.has-new-flux.outputs.version
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.23.X
- name: Upgrade flux
run: |
sed -i 's/^FLUX_VERSION=.*/FLUX_VERSION=${{ needs.has-new-flux.outputs.version }}/' Makefile
go get -u github.com/fluxcd/flux2
go mod tidy
- name: Create Pull Request
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
with:
author: weave-gitops-bot <[email protected]>
signoff: true
committer: weave-gitops-bot <[email protected]>
branch: upgrade-flux
base: main
title: "Upgrade flux to ${{ needs.has-new-flux.outputs.version }}"
token: ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }}
body: |
Upgrade the flux version used by gitops run and the package
dependencies.