Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add release-related files and create sync group for auto-releasing repos #42

Merged
merged 7 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 36 additions & 23 deletions .github/sync.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
group:
repos: |
neurobagel/annotation_tool
neurobagel/api
neurobagel/bagel-cli
neurobagel/bagelschema
neurobagel/bulk_annotations
neurobagel/browbids
neurobagel/digest
neurobagel/documentation
neurobagel/neurobagel_examples
neurobagel/federation-api
neurobagel/menu
neurobagel/openneuro-annotations
neurobagel/planning
neurobagel/proc_dash
neurobagel/project
neurobagel/project
neurobagel/query-tool
neurobagel/recipes
neurobagel/workflows
files:
- source: template_workflows/
dest: .github/workflows/
# Workflows related to project automation
- files:
- source: template_workflows/project_automation/
dest: .github/workflows/
repos: |
neurobagel/annotation_tool
neurobagel/api
neurobagel/bagel-cli
neurobagel/bagelschema
neurobagel/bulk_annotations
neurobagel/browbids
neurobagel/digest
neurobagel/documentation
neurobagel/neurobagel_examples
neurobagel/federation-api
neurobagel/menu
neurobagel/openneuro-annotations
neurobagel/planning
neurobagel/project
neurobagel/query-tool
neurobagel/recipes
neurobagel/workflows

# Workflow and configuration files for auto-releasing with intuit/auto
- files:
- source: template_workflows/auto_release/
dest: .github/workflows/
- source: template_configs/.autorc
dest: .autorc
alyssadai marked this conversation as resolved.
Show resolved Hide resolved
- source: template_prs/auto_release_repo_pr.md
dest: .github/pull_request_template.md
# TODO: add JS repos once React migration is complete?
repos: |
neurobagel/api
neurobagel/bagel-cli
neurobagel/federation-api
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

This repo helps automatically synchronize shared workflows across repos.

`/template_workflows/` contains inert templates for workflows we want in multiple repos - these templates are not doing anything on their own.
`template_workflows/` and `template_configs/` contain inert templates for files we want in multiple repos - these templates are not doing anything on their own.

`.github/sync.yml` is a config file (containing repo names) which is read by `.github/workflows/sync_wf.yml`.

`.github/workflows/sync_wf.yml` is the actual unique active workflow in this repo which takes everything in `/template_workflows/` and makes PRs to add them to each repo listed in the config file.
`.github/workflows/sync_wf.yml` is the actual unique active workflow in this repo which takes the files in the template directories and makes PRs to adds them to appropriate repos listed in the config file.
116 changes: 116 additions & 0 deletions template_configs/.autorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"onlyPublishWithReleaseLabel": true,
"noDefaultLabels": true,
"baseBranch": "main",
"author": "Chef Bot <[email protected]>",
"noVersionPrefix": false,
"plugins": [
"git-tag",
"released",
"protected-branch",
"first-time-contributor",
"omit-commits",
{
"username": "dependabot[bot]",
"subject": "[pre-commit.ci]",
"labels": "_bot"
}
],
"labels": [
{
"name": "pr-major-breaking",
"changelogTitle": "💥 Breaking Changes",
"description": "Significant behaviour change that breaks compatibility, will increment major version (+1.0.0)",
"releaseType": "major",
"overwrite": true,
"color": "#C5000B"
},
{
"name": "pr-minor-breaking",
"changelogTitle": "💥 Breaking Changes",
"description": "Feature or enhancement that breaks compatibility, will increment minor version (0.+1.0)",
"releaseType": "minor",
"overwrite": true,
"color": "#F1A60E"
},
{
"name": "pr-minor",
"changelogTitle": "🚀 Enhancements",
"description": "Non-breaking feature or enhancement, will increment minor version (0.+1.0)",
"releaseType": "minor",
"overwrite": true,
"color": "#F1A60E"
},
{
"name": "pr-patch",
"changelogTitle": "🚀 Enhancements",
"description": "Incremental feature improvement, will increment patch version when merged (0.0.+1)",
"releaseType": "patch",
"overwrite": true,
"default": true,
"color": "#870048"
},
{
"name": "pr-bug-fix",
"changelogTitle": "🐛 Bug Fixes",
"description": "Bug fix, will increment patch version when merged (0.0.+1)",
"releaseType": "patch",
"overwrite": true,
"color": "#870048"
},
{
"name": "pr-internal",
"changelogTitle": "🏠 Internal",
"description": "Non-user-facing code improvement, will increment patch version when merged (0.0.+1)",
"releaseType": "patch",
"overwrite": true,
"color": "#696969"
},
{
"name": "pr-performance",
"changelogTitle": "🏎 Performance Improvements",
"description": "Improve performance of an existing feature, will increment patch version when merged (0.0.+1)",
"releaseType": "patch",
"overwrite": true,
"color": "#f4b2d8"
},
{
"name": "pr-documentation",
"changelogTitle": "📝 Documentation",
"description": "Change that only affects user documentation",
"releaseType": "none",
"overwrite": true,
"color": "#cfd3d7"
},
{
"name": "pr-tests",
"changelogTitle": " 🧪 Tests",
"description": "Add or improve existing tests",
"releaseType": "none",
"overwrite": true,
"color": "#ffd3cc"
},
{
"name": "pr-dependencies",
"changelogTitle": "🔩 Dependency Updates",
"description": "Update one or more dependencies version",
"releaseType": "none",
"overwrite": true,
"color": "#8732bc"
},
{
"name": "skip-release",
"description": "PR doesn't appear in the changelog and preserves current version when merged",
"releaseType": "skip",
"overwrite": true,
"color": "#bf5416"
},
{
"name": "release",
"description": "Create a release when this PR is merged",
"releaseType": "release",
"overwrite": true,
"color": "#007f70"
}
]
}
41 changes: 41 additions & 0 deletions template_prs/auto_release_repo_pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--- Until this PR is ready for review, you can include [WIP] in the title, or create a draft PR. -->


<!---
Below is a suggested pull request template. Feel free to add more details you feel are relevant/necessary.

For more info on the PR process for Neurobagel repositories, see https://neurobagel.org/contributing/pull_requests/.
-->

<!--
Please indicate after the # which issue you're closing with this PR, if applicable.
If the PR closes multiple issues, include "closes" before each one is listed.
You can also link to other issues if necessary, e.g. "See also #1234".

https://help.github.com/articles/closing-issues-using-keywords
-->
- Closes #

<!--
Please give a brief overview of what has changed or been added in the PR.
This can include anything specific the maintainers should be looking for when they review the PR.
-->
Changes proposed in this pull request:

-
-

<!-- To be checked off by reviewers -->
## Checklist

- [ ] PR has an interpretable title with a prefix (`[ENH]`, `[FIX]`, `[REF]`, `[TST]`, `[CI]`, `[MNT]`, `[INF]`, `[MODEL]`, `[DOC]`) _(see https://neurobagel.org/contributing/pull_requests for more info)_
- [ ] PR has a label for the release changelog or `skip-release` (to be applied by maintainers only)
- [ ] PR links to GitHub issue with mention `Closes #XXXX`
- [ ] Tests pass
- [ ] Checks pass

For new features:
- [ ] Tests have been added

For bug fixes:
- [ ] There is at least one test that would fail under the original bug conditions.
28 changes: 28 additions & 0 deletions template_workflows/auto_release/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: auto release

on:
push:
branches:
- main

jobs:
auto-release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download latest auto
run: |
auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/latest | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')"
wget -O- "$auto_download_url" | gunzip > ~/auto
chmod a+x ~/auto

- name: Release
run: ~/auto shipit -vv
env:
GH_TOKEN: ${{ secrets.NB_PAT_RELEASE }}
PROTECTED_BRANCH_REVIEWER_TOKEN: ${{ secrets.NB_PAT_RELEASE_PROTECTED }}