Skip to content

Windows signing re-evaluation #133

Windows signing re-evaluation

Windows signing re-evaluation #133

name: Automated kubectl versions
on:
issue_comment:
types:
- created
schedule:
- cron: 26 6 * * *
workflow_dispatch: {}
permissions:
contents: write
id-token: write
pull-requests: write
jobs:
kubectl-versions:
name: kubectl versions
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
arch: x64
runs-on: ${{ matrix.os }}
environment: automated
if: >-
github.event_name != 'issue_comment' ||
contains(github.event.comment.body, '/rerun')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Get npm cache directory
run: echo "npm_cache_dir=$(npm config get cache)" >> ${GITHUB_ENV}
- name: Use npm cache
uses: actions/cache@v4
with:
path: ${{ env.npm_cache_dir }}
key: ${{ matrix.os }}-${{ matrix.arch }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.arch }}-node-
- name: Install npm dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
max_attempts: 3
retry_on: any
command: npm ci
- name: kubectl versions
run: npm run compute-versions
- name: Bundle the latest kubectl version
run: |
cat packages/kubectl-versions/build/versions.json | yq -pj '.[-1][-1]' > .github/version.log
version=$(cat .github/version.log)
yq -pj -oj -i '.config.bundledKubectlVersion="'"$version"'"' freelens/package.json
yq -pj -oj -i '.config.bundledKubectlVersion="'"$version"'"' packages/core/package.json
echo "Bundled kubectl version $version" > .github/pr_body.log
- name: Check for changes
run: |
if git diff --exit-code; then
echo "changes=false" >> $GITHUB_ENV
else
echo "changes=true" >> $GITHUB_ENV
fi
- name: Commit and push to branch
if: env.changes == 'true'
uses: EndBug/add-and-commit@v9
with:
github_token: ${{ secrets.GH_TOKEN }}
default_author: github_actions
message: Automated update of kubectl versions
new_branch: automated/kubectl-versions
push: origin automated/kubectl-versions --set-upstream --force
- name: Create pull request
id: pr
if: env.changes == 'true'
uses: devops-infra/action-pull-request@master
with:
github_token: ${{ secrets.GH_TOKEN }}
target_branch: main
label: kubectl
title: Automated update of kubectl versions
get_diff: true
- name: Update pull request description
if: env.changes == 'true'
run: gh pr edit ${{ steps.pr.outputs.pr_number }} --title "Automated update of kubectl versions (bundled $(cat .github/version.log))" --body-file .github/pr_body.log
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Close pull request
if: env.changes == 'false'
run: gh pr list --head automated/kubectl-versions --json number --jq '.[].number' | xargs -rn1 gh pr close --delete-branch
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}