Skip to content
1 change: 1 addition & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
IMAGE: ${{ secrets.DOCKER_USERNAME }}/p5.js-web-editor-staging
jobs:
push_to_registry:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment: staging
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: Deploy to production
on:
workflow_run:
workflows: ["Test"]
branches:
- release
release:
types:
- completed
- published
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: p5-gke-cluster
Expand All @@ -21,7 +18,7 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v3
with:
ref: release
ref: ${{ github.event.release.tag_name }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/release-reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Weekly release reminder

on:
# Tuesdays 15:30 UTC
schedule:
- cron: "30 15 * * 2"
workflow_dispatch: {}

permissions:
issues: write

jobs:
remind:
runs-on: ubuntu-latest
steps:
- name: Open release reminder issue
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Weekly release - ${new Date().toISOString().slice(0, 10)}`,
body: [
"1. Decide on any remaining PRs to merge into `develop`",
"2. Review what's merged into `develop` since the last release.",
"3. Decide the version bump (patch/minor/major).",
"4. Run the [Create a release](../actions/workflows/release.yml) workflow with that version.",
"",
"No release needed this week? Just close this issue."
].join("\n")
});
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Create a release

on:
workflow_dispatch:
inputs:
newversion:
description: >
Version to release. Accepts an explicit semver (e.g. 2.22.0) or an
npm version keyword (patch, minor, major, prepatch, preminor,
premajor, prerelease). See https://docs.npmjs.com/cli/version
required: true
type: string

permissions:
contents: write

jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Check out develop
uses: actions/checkout@v4
with:
ref: develop

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18.20.x'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test:ci

# future: deploy to staging (+stop deploying to staging upon merges to develop) + e2e test pointed at staging

release:
needs: verify
runs-on: ubuntu-latest
# Requires a maintainer to approve in the Actions UI before this job runs.
# Configure required reviewers under Settings > Environments > release-approval.
environment: release-approval

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doradocodes @raclim could we add this new github actions environment, with a list of designated approvers

steps:
- name: Check out develop
uses: actions/checkout@v4
with:
ref: develop

- name: Fetch release branch
run: git fetch origin release:release

- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Create cut release branch
run: git checkout -b "release-${{ inputs.newversion }}"

- name: Bump version
id: bump
run: |
NEW_VERSION=$(npm version "${{ inputs.newversion }}" -m "v%s")
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"

- name: Merge into release
run: |
git checkout release
git pull origin release
git merge --no-ff "release-${{ inputs.newversion }}" -m "Merge release-${{ inputs.newversion }} into release"
git push origin release
git push origin --tags

- name: Merge back into develop
run: |
git checkout develop
git pull origin develop
git merge --no-ff "release-${{ inputs.newversion }}" -m "Merge release-${{ inputs.newversion }} into develop"
git push origin develop

- name: Push cut release branch
run: git push origin "release-${{ inputs.newversion }}"

- name: Draft GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.bump.outputs.version }}" \
--target release \
--title "${{ steps.bump.outputs.version }}" \
--generate-notes \
--draft
39 changes: 34 additions & 5 deletions contributor_docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,39 @@
A guide for deploying a release to the p5.js Editor production environment.

## Background

This project's release guide is based on:
* [git-flow](https://nvie.com/posts/a-successful-git-branching-model/)
* [Semantic Versioning (semver)](https://semver.org/)
* [npm-version](https://docs.npmjs.com/cli/version)
* [Let's stop saying Master/Slave](https://medium.com/@mikebroberts/let-s-stop-saying-master-slave-10f1d1bf34df)

## Steps
- [git-flow](https://nvie.com/posts/a-successful-git-branching-model/)
- [Semantic Versioning (semver)](https://semver.org/)
- [npm-version](https://docs.npmjs.com/cli/version)
- [Let's stop saying Master/Slave](https://medium.com/@mikebroberts/let-s-stop-saying-master-slave-10f1d1bf34df)

## Steps for a standard release:

### via GHA:

1. An issue titled "Weekly release - DATE" will be created every Tuesday at 15:30 UTC. Go to the [Issues tab](https://github.com/processing/p5.js-web-editor/issues) and click the link in the description to the [Create a release](../.github/workflows/release.yml) GitHub Actions workflow.
2. Run the **Create a release** workflow via "Run workflow".
3. Enter the `version` to release
1. `version` can be `major`, `minor`, `patch`, etc. (see [npm-version](https://docs.npmjs.com/cli/version) for valid values.
4. Wait for the workflow to run the `verify` job.
1. This tests the checkout code from `develop`.
2. If tests fail, the workflow will stop & record its result as a failure. Devs should fix any test failures, then attempt the [Create a release](../.github/workflows/release.yml) workflow again.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if the tests fail, will the version get bumped twice?

@clairep94 clairep94 Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the release.yaml > verify job doesn't include steps for bumping, those are in the release.yaml > release job
The input for version is just captured and used later on the release.yaml > release job (if release.yaml > verify passes)

3. If the tests succeed, the workflow will wait on maintainer approval for the `draft-release` job.
5. Go to [Staging](https://stagingeditor.p5js.org) and perform any remaining manual checks.
6. If all looks good, approve the `release` job.
1. This does the manual steps 5-12 below:
1. Merges the cut release into `release`
2. Merges `release` into `develop`
3. Creates a new draft GitHub release with auto-generated notes & version & tags.
8. [Review the drafted release](https://github.com/processing/p5.js-web-editor/releases) and click **Publish release** when ready. This will then trigger the deployment to [Production](editor.p5js.org).
9. **Manually** verify the release has completed successfully:
1. `$ kubectl get pods --namespace production` to check the pods are running (this might take a few minutes and you can rerun the command to check again).
2. Validate that [production](https://stagingeditor.p5js.org/) is working and you are finished!

### Manually:

1. `$ git checkout develop`
2. `$ git pull origin develop`
3. `$ git checkout -b release-<newversion>`
Expand All @@ -31,8 +57,11 @@ This project's release guide is based on:


## Steps for a Patch Release

Sometimes you might need to push a release for an isolated and small bug fix without what's currently been merged into the `develop` branch. The steps for pushing a Patch Release are similar to a standard Release, except you work with the `release` branch as opposed to `develop`.

This process is not yet automated by the Actions workflow above, so it's still done by hand.

1. `$ git checkout release`
2. `$ git pull origin release`
3. `$ git checkout -b release-<newversion>` (increment patch version)
Expand Down
Loading