uncomment creating PR in plus job, remove npx proje build unnecessary… #89
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". | |
name: k8s-upgrade-automation | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: 0 18 * * 0 | |
push: | |
branches: | |
- sumughan/automate-k8s-release-step1 | |
jobs: | |
check-latest-k8s-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
outputs: | |
latestVersion: ${{ steps.k8s-latest-version.outputs.latestVersion }} | |
httpStatus: ${{ steps.get-npm-status-code.outputs.httpStatus }} | |
steps: | |
- name: Get latest K8s Release | |
id: get-k8s-latest-release | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: kubernetes/kubernetes | |
excludes: prerelease, draft | |
- name: Get latest K8s minor version | |
id: k8s-latest-version | |
run: echo latestVersion="$(cut -d "." -f 2 <<< "${{ steps.get-k8s-latest-release.outputs.release }}")" >> $GITHUB_OUTPUT | |
- name: Check to see if cdk8s-plus released latest k8s version on npm by getting HTTP status code from npm url | |
id: get-npm-status-code | |
run: |- | |
echo httpStatus="$(curl -sL -w "%{http_code} | |
" "https://www.npmjs.com/package/cdk8s-plus-27" -o /dev/null)" >> $GITHUB_OUTPUT | |
generate-new-k8s-spec: | |
needs: check-latest-k8s-release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
if: needs.check-latest-k8s-release.outputs.httpStatus == 200 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.12.0 | |
- name: Install dependencies | |
run: yarn install --check-files | |
- name: Generate Kubernetes schema | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
run: ${{ github.workspace }}/tools/import-spec.sh 1.${{ needs.check-latest-k8s-release.outputs.latestVersion }}.0 | |
continue-on-error: false | |
create-go-repo-branch: | |
needs: check-latest-k8s-release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
if: needs.check-latest-k8s-release.outputs.httpStatus == 200 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: cdk8s-team/cdk8s-plus-go | |
- name: Create new branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
run: git checkout -b k8s.${{ needs.check-latest-k8s-release.outputs.latestVersion }} | |
continue-on-error: false | |
add-backport-label: | |
needs: check-latest-k8s-release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
if: needs.check-latest-k8s-release.outputs.httpStatus == 200 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: cdk8s-team/cdk8s-plus | |
create-new-plus-branch: | |
needs: | |
- check-latest-k8s-release | |
- generate-new-k8s-spec | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: cdk8s-team/cdk8s-plus | |
- name: Create new branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
run: git checkout -b k8s-${{ needs.check-latest-k8s-release.outputs.latestVersion }}/main | |
continue-on-error: false | |
- name: Update reference of latest cdk8s version in txt file | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
run: echo "${{ needs.check-latest-k8s-release.outputs.latestVersion }}" >> ${{ github.workspace }}/projenrc/latest-k8s-version.txt | |
continue-on-error: false | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.12.0 | |
- name: Install dependencies | |
run: yarn install --check-files | |
- name: Import the new k8s spec from the prerequisite step | |
run: yarn run import | |
- name: Let projen update the remaining files | |
run: npx projen build | |
- name: Update references of old kubernetes versions with projen task | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
run: npx projen update-k8s-version-references | |
continue-on-error: false | |
update-cdk8s-website: | |
needs: | |
- check-latest-k8s-release | |
- create-new-plus-branch | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
if: needs.check-latest-k8s-release.outputs.httpStatus == 200 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Create new branch | |
uses: peterjgrainger/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
with: | |
branch: cdk8s-upgrade/v${{ needs.check-latest-k8s-release.outputs.latestVersion }} | |
sha: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.12.0 | |
- name: Install dependencies | |
run: yarn install --check-files | |
- name: Update references to newest k8s version in cdk8s repo | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
run: npx projen replace-old-version-references | |
continue-on-error: false | |
- name: Create Pull Request | |
id: create-pr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
commit-message: |- | |
chore(website): cdk8s-plus-${{ needs.check-latest-k8s-release.outputs.latestVersion }} | |
This PR updates the website with the latest version of cdk8s-plus. See details in [workflow run]. | |
[Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
------ | |
*Automatically created by projen via the "create-pull-request" workflow* | |
branch: github-actions/website-update-${{ needs.check-latest-k8s-release.outputs.latestVersion }} | |
title: "chore(website): cdk8s-plus-${{ needs.check-latest-k8s-release.outputs.latestVersion }}" | |
body: |- | |
This PR updates the website with the latest version of cdk8s-plus. See details in [workflow run]. | |
[Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
------ | |
*Automatically created by projen via the "create-pull-request" workflow* | |
author: github-actions <[email protected]> | |
committer: github-actions <[email protected]> | |
signoff: true | |
update-cdk-ops: | |
needs: | |
- check-latest-k8s-release | |
- update-cdk8s-website | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
repository: cdk8s-team/cdk-ops | |
- name: Update latest cdk8s-plus version in cdk-ops repo | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
run: echo "${{ needs.check-latest-k8s-release.outputs.latestVersion }}" >> ${{ github.workspace }}/projenrc/latest-cdk8s-version.txt | |
continue-on-error: false |