-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a25a3b1
commit f39cf15
Showing
8 changed files
with
214 additions
and
51 deletions.
There are no files selected for viewing
Binary file not shown.
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,5 @@ | ||
--- | ||
'@jakubmazanec/carson-templates': minor | ||
--- | ||
|
||
Adds support for Renovate bot to the GitHub workflows in `workspace` template. |
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 |
---|---|---|
|
@@ -6,15 +6,21 @@ on: | |
- development | ||
|
||
jobs: | ||
pull_request_check: | ||
check_pull_request: | ||
name: Check pull request | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{secrets.GITHUB_TOKEN}} | ||
token: ${{secrets.PAT}} | ||
fetch-depth: 0 | ||
|
||
- name: Configure git | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "Bot" | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
@@ -23,6 +29,7 @@ jobs: | |
run: npm ci | ||
|
||
- name: Check for changes | ||
if: "github.actor != 'renovate[bot]'" | ||
run: | | ||
git config core.filemode false | ||
git_status=$(git status --porcelain) | ||
|
@@ -40,6 +47,7 @@ jobs: | |
run: npm test | ||
|
||
- name: Check for changes | ||
if: "github.actor != 'renovate[bot]'" | ||
run: | | ||
git config core.filemode false | ||
git_status=$(git status --porcelain) | ||
|
@@ -54,4 +62,5 @@ jobs: | |
git config --unset core.filemode | ||
- name: Check for changesets | ||
if: "github.actor != 'renovate[bot]'" | ||
run: npx changeset status --since=origin/development |
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Release | |
on: [push, workflow_dispatch] | ||
|
||
jobs: | ||
main_branch_release: | ||
release_main_branch: | ||
name: Main branch release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
|
@@ -39,7 +39,7 @@ jobs: | |
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -56,7 +56,7 @@ jobs: | |
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -127,7 +127,7 @@ jobs: | |
git merge main --no-verify | ||
git push -u origin development --no-verify | ||
development_branch_release: | ||
release_development_branch: | ||
name: Development branch release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
|
@@ -163,7 +163,7 @@ jobs: | |
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -180,7 +180,7 @@ jobs: | |
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -220,11 +220,13 @@ jobs: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
feature_branch_release: | ||
release_feature_branch: | ||
name: Feature branch release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
if: "github.ref_name != 'main' && github.ref_name != 'development'" | ||
if: | ||
"github.ref_name != 'main' && github.ref_name != 'development' && github.actor != | ||
'renovate[bot]'" | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
|
@@ -256,7 +258,7 @@ jobs: | |
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -273,7 +275,7 @@ jobs: | |
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
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 |
---|---|---|
@@ -1,25 +1,16 @@ | ||
name: Generate changeset | ||
name: Update pull request | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request_target: | ||
paths: | ||
- '.github/workflows/renovate.yaml' | ||
- '**/package.json' | ||
- '**/package-lock.json' | ||
branches: [development] | ||
|
||
jobs: | ||
generate-changeset: | ||
name: Generate changeset | ||
update_pull_request: | ||
name: Update pull request | ||
if: ${{ github.actor == 'renovate[bot]' && contains(github.head_ref, 'renovate/') }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
if: github.actor == 'renovate[bot]' | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
@@ -31,8 +22,16 @@ jobs: | |
git config user.email "[email protected]" | ||
git config user.name "Bot" | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install packages | ||
run: npm ci | ||
|
||
- name: Generate changeset | ||
uses: actions/github-script@v6 | ||
if: ${{ github.actor == 'renovate[bot]' }} | ||
with: | ||
script: | | ||
let { promises: fs } = require('fs'); | ||
|
@@ -56,9 +55,11 @@ jobs: | |
for (let [packageName, bump] of packageBumps) { | ||
message = | ||
message + `Dependency \`${packageName}\` updated to \`${bump}\`.\n`; | ||
message + `Dependency \`${packageName}\` updated to version \`${bump}\`.\n`; | ||
} | ||
message = message.replace('\n', ' '); | ||
let header = packages | ||
.map((packageName) => `'${packageName}': patch`) | ||
.join('\n'); | ||
|
@@ -86,14 +87,6 @@ jobs: | |
return bumps; | ||
} | ||
let branch = await exec.getExecOutput('git branch --show-current'); | ||
if (!branch.stdout.startsWith('renovate/')) { | ||
console.log('Not a renovate branch, skipping...'); | ||
return; | ||
} | ||
let diffOutput = await exec.getExecOutput('git diff --name-only HEAD~1'); | ||
let diffFiles = diffOutput.stdout.split('\n'); | ||
|
@@ -111,6 +104,8 @@ jobs: | |
if (!packageNames.length) { | ||
console.log('No package.json changes to published packages, skipping...'); | ||
await exec.exec('npx', ['changeset', '--empty']); | ||
return; | ||
} | ||
|
@@ -121,6 +116,15 @@ jobs: | |
let packageBumps = await getBumps(files); | ||
await createChangeset(fileName, packageBumps, packageNames); | ||
await exec.exec('git', ['add', fileName]); | ||
await exec.exec('git commit -C HEAD --amend --no-edit'); | ||
await exec.exec('git push --force'); | ||
- name: Update Carson | ||
if: ${{ github.actor == 'renovate[bot]' }} | ||
run: | | ||
npm install | ||
- name: Commit and push changes | ||
if: ${{ github.actor == 'renovate[bot]' }} | ||
run: | | ||
git add . --all | ||
git commit -C HEAD --amend --no-edit | ||
git push --force |
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 |
---|---|---|
|
@@ -10,15 +10,21 @@ on: | |
- development | ||
|
||
jobs: | ||
pull_request_check: | ||
check_pull_request: | ||
name: Check pull request | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{secrets.GITHUB_TOKEN}} | ||
token: ${{secrets.PAT}} | ||
fetch-depth: 0 | ||
|
||
- name: Configure git | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "Bot" | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
@@ -27,6 +33,7 @@ jobs: | |
run: npm ci | ||
|
||
- name: Check for changes | ||
if: "github.actor != 'renovate[bot]'" | ||
run: | | ||
git config core.filemode false | ||
git_status=$(git status --porcelain) | ||
|
@@ -44,6 +51,7 @@ jobs: | |
run: npm test | ||
|
||
- name: Check for changes | ||
if: "github.actor != 'renovate[bot]'" | ||
run: | | ||
git config core.filemode false | ||
git_status=$(git status --porcelain) | ||
|
@@ -58,4 +66,5 @@ jobs: | |
git config --unset core.filemode | ||
|
||
- name: Check for changesets | ||
run: npx changeset status --since=origin/development | ||
if: "github.actor != 'renovate[bot]'" | ||
run: npx changeset status --since=origin/<%- getDevelopmentBranch(workspace) %> |
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ name: Release | |
on: [push, workflow_dispatch] | ||
|
||
jobs: | ||
main_branch_release: | ||
release_main_branch: | ||
name: Main branch release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
|
@@ -43,7 +43,7 @@ jobs: | |
|
||
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -60,7 +60,7 @@ jobs: | |
|
||
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -131,7 +131,7 @@ jobs: | |
git merge <%- getMainBranch(workspace) %> --no-verify | ||
git push -u origin <%- getDevelopmentBranch(workspace) %> --no-verify | ||
|
||
development_branch_release: | ||
release_development_branch: | ||
name: Development branch release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
|
@@ -167,7 +167,7 @@ jobs: | |
|
||
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -184,7 +184,7 @@ jobs: | |
|
||
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -224,11 +224,11 @@ jobs: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
feature_branch_release: | ||
release_feature_branch: | ||
name: Feature branch release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
if: "github.ref_name != '<%- getMainBranch(workspace) %>' && github.ref_name != '<%- getDevelopmentBranch(workspace) %>'" | ||
if: "github.ref_name != '<%- getMainBranch(workspace) %>' && github.ref_name != '<%- getDevelopmentBranch(workspace) %>' && github.actor != 'renovate[bot]'" | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
|
@@ -260,7 +260,7 @@ jobs: | |
|
||
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
@@ -277,7 +277,7 @@ jobs: | |
|
||
if [[ -n $git_status ]]; then | ||
echo "You have uncommitted changes!" | ||
git status --porcelain | ||
git diff | ||
git config --unset core.filemode | ||
exit 1 | ||
fi | ||
|
Oops, something went wrong.