mirror of
https://github.com/flatcar/scripts.git
synced 2026-04-27 16:32:08 +02:00
Use a dedicated personal access token BOT_PR_TOKEN for bot PRs instead of the default GITHUB_TOKEN. It is needed for triggering another workflow from pull requests created by Github Actions. The default GITHUB_TOKEN is by design not able to trigger another workflow. See also https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
53 lines
2.5 KiB
YAML
53 lines
2.5 KiB
YAML
name: Get the latest Docker release for main
|
|
on:
|
|
schedule:
|
|
- cron: '35 7 * * 3'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
get-docker-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out scripts
|
|
uses: actions/checkout@v3
|
|
with:
|
|
token: ${{ secrets.BOT_PR_TOKEN }}
|
|
path: scripts
|
|
- name: Figure out latest Docker release version
|
|
id: docker-latest-release
|
|
run: |
|
|
versionCommitPairMoby=( $(git ls-remote --tags https://github.com/moby/moby | grep 'refs/tags/v[0-9]*\.[0-9]*\.[0-9]*$' | sed -e 's#^\([0-9a-fA-F]*\)[[:space:]]*refs/tags/v\(.*\)$#\2 \1#g' | sort --reverse --unique --version-sort | head --lines 1) )
|
|
commitHashCLI=$(git ls-remote --tags https://github.com/docker/cli | grep 'refs/tags/v'"${versionCommitPairMoby[0]}"'$' | cut -f1)
|
|
|
|
echo "VERSION_NEW=${versionCommitPairMoby[0]}" >>"${GITHUB_OUTPUT}"
|
|
echo "COMMIT_HASH_MOBY=${versionCommitPairMoby[1]}" >>"${GITHUB_OUTPUT}"
|
|
echo "COMMIT_HASH_CLI=${commitHashCLI}" >>"${GITHUB_OUTPUT}"
|
|
- name: Set up Flatcar SDK
|
|
id: setup-flatcar-sdk
|
|
env:
|
|
WORK_SCRIPTS_DIR: "${{ github.workspace }}/scripts"
|
|
CHANNEL: main
|
|
run: scripts/.github/workflows/setup-flatcar-sdk.sh
|
|
- name: Apply patch for main
|
|
id: apply-patch-main
|
|
env:
|
|
GHA_SCRIPTS_DIR: "${{ github.workspace }}/scripts"
|
|
WORK_SCRIPTS_DIR: "${{ github.workspace }}/scripts"
|
|
VERSION_NEW: ${{ steps.docker-latest-release.outputs.VERSION_NEW }}
|
|
COMMIT_HASH_MOBY: ${{ steps.docker-latest-release.outputs.COMMIT_HASH_MOBY }}
|
|
COMMIT_HASH_CLI: ${{ steps.docker-latest-release.outputs.COMMIT_HASH_CLI }}
|
|
PACKAGES_CONTAINER: ${{ steps.setup-flatcar-sdk.outputs.PACKAGES_CONTAINER }}
|
|
SDK_NAME: ${{ steps.setup-flatcar-sdk.outputs.SDK_NAME }}
|
|
run: scripts/.github/workflows/docker-apply-patch.sh
|
|
- name: Create pull request for main
|
|
uses: peter-evans/create-pull-request@v5
|
|
if: steps.apply-patch-main.outputs.UPDATE_NEEDED == 1
|
|
with:
|
|
token: ${{ secrets.BOT_PR_TOKEN }}
|
|
path: scripts
|
|
branch: docker-${{ steps.docker-latest-release.outputs.VERSION_NEW }}-main
|
|
base: main
|
|
title: Upgrade Docker in main from ${{ steps.apply-patch-main.outputs.VERSION_OLD }} to ${{ steps.docker-latest-release.outputs.VERSION_NEW }}
|
|
body: Subject says it all.
|
|
labels: main
|