Skip to content

update

update #23336

Workflow file for this run

name: update
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
jobs:
update-flux:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.20.x
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update component versions
id: update
run: |
RELEASE_VERSION=$(flux version --client | awk '{print $2}')
CURRENT_VERSION=$(go list -m all | grep github.com/fluxcd/flux2 | awk '{print $2}')
if [[ "${RELEASE_VERSION}" != "${CURRENT_VERSION}" ]]; then
go mod edit -require github.com/fluxcd/flux2/v2@${RELEASE_VERSION}
go mod tidy -compat=1.20
fi
git diff
PR_TITLE="Update Flux to ${RELEASE_VERSION}"
PR_BODY=$(mktemp)
echo "- github.com/fluxcd/flux2 to ${RELEASE_VERSION}" >> $PR_BODY
echo " https://github.com/fluxcd/flux2/releases/${RELEASE_VERSION}" >> $PR_BODY
# NB: this may look strange but it is the way it should be done to
# maintain our precious newlines
# Ref: https://github.com/github/docs/issues/21529
echo 'pr_body<<EOF' >> $GITHUB_OUTPUT
cat $PR_BODY >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
echo "pr_title=$PR_TITLE" >> $GITHUB_OUTPUT
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
commit-message: |
${{ steps.update.outputs.pr_title }}
${{ steps.update.outputs.pr_body }}
committer: GitHub <noreply@github.com>
author: fluxcdbot <fluxcdbot@users.noreply.github.com>
signoff: true
title: ${{ steps.update.outputs.pr_title }}
body: |
${{ steps.update.outputs.pr_body }}
branch: update-components
labels: |
area/build
reviewers: ${{ secrets.ASSIGNEES }}
- name: Check output
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"