Skip to content

fix(stages): accountExtractor in k8s stages should extract data from … #1355

fix(stages): accountExtractor in k8s stages should extract data from …

fix(stages): accountExtractor in k8s stages should extract data from … #1355

name: Create package bump PR
concurrency:
group: create-package-bump-pr
cancel-in-progress: true
on:
push:
branches:
- 'master'
tags:
- '@spinnaker/*'
env:
NODE_VERSION: 14.21.3
jobs:
build:
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master
- name: git - configure commit user
run: |
git config user.name spinnakerbot
git config user.email spinnakerbot@spinnaker.io
git checkout master
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: yarn - get cache dir
id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn - Install Dependencies
run: yarn --frozen-lockfile
- name: lerna - Bump packages
id: lerna_bump
run: |
scripts/gha_bump_packages.sh
env:
COMMIT_SHA: ${{ github.sha }}
- name: gha - get bumped packages
id: bumps
run: |
scripts/gha_output_bumped_packages.sh
scripts/gha_output_changelog.sh
env:
PACKAGE_BUMP_COMMIT_HASH: ${{ steps.lerna_bump.outputs.packageBumpCommitHash }}
PEERDEP_BUMP_COMMIT_HASH: ${{ steps.lerna_bump.outputs.peerdepBumpCommitHash }}
- name: Create Pull Request
id: createpullrequest
uses: peter-evans/create-pull-request@v7
with:
token: '${{ secrets.SPINNAKERBOT_PERSONAL_ACCESS_TOKEN }}'
commit-message: 'chore(package): Publish ${{ steps.bumps.outputs.bumps }}'
title: 'Publish packages to NPM'
labels: publish
body: |
### This PR bumps the version(s) of all Deck package(s) that have unpublished changes.
${{ steps.bumps.outputs.changelog }}
---
This PR bumps each package to the next semver version (patch/minor/major) based on the commit messages of unpublished changes using [Conventional Commits](https://conventionalcommits.org).
- fix: patch release
- feat: minor release
- BREAKING CHANGE: major release
It also updates dependency versions in other packages in the monorepo which depend on the bumped package(s).
After this PR is merged, Github Actions will publish any bumped packages to the NPM registry.
_Auto-generated by `.github/workflows/package-bump-pr.yml`_
- name: Close package bump due to no changes
if: ${{ steps.lerna_bump.outputs.packageBumpCommitHash == '' && steps.createpullrequest.outputs.pull-request-number != '' }}
uses: actions/github-script@v7.0.1
with:
github-token: '${{ secrets.SPINNAKERBOT_PERSONAL_ACCESS_TOKEN }}'
script: |
const { owner, repo } = context.repo;
const pull_number = ${{ steps.createpullrequest.outputs.pull-request-number }};
await github.rest.pulls.update({ owner, repo, pull_number, state: 'closed' });
- name: Approve package bump
if: ${{ steps.lerna_bump.outputs.packageBumpCommitHash != '' && steps.createpullrequest.outputs.pull-request-number != '' }}
uses: actions/github-script@v7.0.1
with:
github-token: '${{ secrets.SPINNAKERBOT_TOKEN }}'
script: |
const { owner, repo } = context.repo;
const pull_number = ${{ steps.createpullrequest.outputs.pull-request-number }};
const users = ['spinnakerbot', 'spinnakerbot2'];
const reviews = await github.rest.pulls.listReviews({ owner, repo, pull_number });
const approved = reviews.data.some((review) => users.includes(review.user.login) && review.state == 'APPROVED');
if (!approved) {
await github.rest.pulls.createReview({ owner, repo, pull_number, event: 'APPROVE' });
}