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 support to publish experimental releases #278

Merged
merged 1 commit into from
May 30, 2023
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
23 changes: 22 additions & 1 deletion .github/workflows/publish-typist-package-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Typist Package Release

on:
workflow_dispatch:
workflow_run:
workflows:
- CI Validation
Expand Down Expand Up @@ -28,7 +29,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60

if: github.event.workflow_run.conclusion == 'success'
# Only run this job when manually triggered for the `experimental` branch, or when triggered
# by the `CI Validation` workflow for the `main` branch
if: |
(github.event_name == 'workflow_dispatch' && contains(github.ref, 'experimental')) ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')

steps:
- name: Checkout repository
Expand Down Expand Up @@ -90,3 +95,19 @@ jobs:
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

fail-manual-trigger:
name: Release & Publish
runs-on: ubuntu-latest
timeout-minutes: 60

# Only run this job when manually triggered for all branches with the exception for the
# `experimental` branch (which is the only branch allowed to be manually triggered)
if: github.event_name == 'workflow_dispatch' && !contains(github.ref, 'experimental')

steps:
- name: Fail job with a message
uses: actions/github-script@v6
with:
script: |
core.setFailed('Triggering this workflow manually is only allowed for the `experimental` branch.')
6 changes: 5 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"branches": [
"main"
"main",
{
"name": "experimental",
"prerelease": true
}
],
"plugins": [
[
Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ After cloning Typist and installing all dependencies, several commands are at yo

The release process for Typist is almost fully automated with [`semantic-release`](https://github.com/semantic-release/semantic-release), only requiring a core team member to trigger [this workflow](https://github.com/Doist/typist/actions/workflows/publish-typist-package-release.yml) manually whenever a new release needs to be published.

#### Experimental Releases

Sometimes the need for an experimental release arises before a new feature or fix is ready for a stable release. In these cases, we can publish an experimental release by pushing code to the `experimental` branch, and manually triggering the [this workflow](https://github.com/Doist/typist/actions/workflows/publish-typist-package-release.yml). The version number will be automatically picked by `semantic-release`, and `-experimental.x` will be appended at the end of the version number, where `x` represents the number of experimental release published to the `experimental` branch.

> **Warning**
> The `experimental` branch should never be deleted nor rebased with `main`, otherwise we might lose the Git tags required for `semantic-release` to properly pick the next experimental version number. Instead, `main` should be merged into the `experimental` branch with a merge commit before pushing new code to the `experimental` branch, so that those experiments are always published with the latest published stable version.

### Visual Studio Code

#### CSS Modules for Storybook
Expand Down