-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update aws service spec in a separate job (#26531)
Currently this is just part of the `Yarn upgrade` workflow. We want a separate workflow so the updates are visible in the CHANGELOG. This should also reduce potential failures in the `Yarn upgrade` workflow and vice-versa, so they don't block each other. Tested o fork: https://github.com/mrgrain/aws-cdk/actions/runs/5680204361 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
3 changed files
with
103 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: AWS Service Spec Update | ||
|
||
on: | ||
schedule: | ||
# Every Monday at 13:37 UTC | ||
- cron: 37 13 * * 1 | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
update-spec: | ||
name: Update AWS Service Spec packages | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check Out | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "*" | ||
env: | ||
NODE_OPTIONS: "--max-old-space-size=8196 --experimental-worker ${NODE_OPTIONS:-}" | ||
|
||
- name: Yarn Install | ||
run: yarn install --frozen-lockfile | ||
- name: Install ncu tool | ||
run: npm -g install lerna npm-check-updates | ||
- name: Run "ncu" for service spec packages | ||
run: lerna exec --parallel ncu -- --upgrade --filter='@aws-cdk/aws-service-spec,@aws-cdk/service-spec-types' --target=latest | ||
|
||
# This will ensure the current lockfile is up-to-date with the dependency specifications | ||
- name: Install latest version & update lockfile | ||
run: |- | ||
yarn upgrade @aws-cdk/aws-service-spec @aws-cdk/service-spec-types | ||
# Next, create and upload the changes as a patch file. This will later be downloaded to create a pull request | ||
# Creating a pull request requires write permissions and it's best to keep write privileges isolated. | ||
- name: Create Patch | ||
run: |- | ||
git add . | ||
git diff --patch --staged > ${{ runner.temp }}/update-spec.patch | ||
- name: Upload Patch | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: update-spec.patch | ||
path: ${{ runner.temp }}/update-spec.patch | ||
|
||
pr: | ||
name: Create Pull Request | ||
needs: update-spec | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Out | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download patch | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: update-spec.patch | ||
path: ${{ runner.temp }} | ||
|
||
- name: Apply patch | ||
run: '[ -s ${{ runner.temp }}/update-spec.patch ] && git apply ${{ runner.temp }}/update-spec.patch || echo "Empty patch. Skipping."' | ||
|
||
- name: Make Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
# Git commit details | ||
branch: automation/spec-update | ||
author: aws-cdk-automation <aws-cdk-automation@users.noreply.github.com> | ||
commit-message: |- | ||
feat: update AWS Service Spec | ||
AWS Service Spec packages to latest versions. | ||
# Pull Request details | ||
title: 'feat: update AWS Service Spec' | ||
body: |- | ||
AWS Service Spec packages to latest versions. | ||
labels: contribution/core,dependencies,auto-approve | ||
team-reviewers: aws-cdk-team | ||
# Github prevents further Github actions to be run if the default Github token is used. | ||
# Instead use a privileged token here, so further GH actions can be triggered on this PR. | ||
token: ${{ secrets.PROJEN_GITHUB_TOKEN }} |
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