-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Create release workflow
#4252
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
base: develop
Are you sure you want to change the base?
Create release workflow
#4252
Changes from all commits
d46bea4
1dd9119
56acb2e
3e32881
abc4454
f91b8f7
1abc4d9
fa7d873
691aed1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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") | ||
| }); |
| 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 | ||
| 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if the tests fail, will the version get bumped twice?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No the |
||
| 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>` | ||
|
|
@@ -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) | ||
|
|
||
There was a problem hiding this comment.
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