Skip to content

update

update #22656

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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
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 }}"