Skip to content

Commit

Permalink
Setup release-please to automate part of our release process (#96)
Browse files Browse the repository at this point in the history
* chore: remove generated code from repo

* chore: move publish working to `release-please`

* update `RELEASING.md`

* chore: fix `npm run build` command
  • Loading branch information
lucasmazza authored Sep 24, 2024
1 parent 2568699 commit 73fce2d
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 13,762 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/publish.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release:
if: github.repository == 'tremendous-rewards/tremendous-node'
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node

- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}

- run: npm ci
if: ${{ steps.release.outputs.release_created }}

- run: npm run build
if: ${{ steps.release.outputs.release_created }}

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/
/npm-debug.log
./dist
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
20 changes: 10 additions & 10 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ bin/generate && npm run build
```

After that, please review the changes to double check that the changes to the API spec were
generated correctly. Please open a Pull Request with the file changes and wait for the test pipeline
before merging it to master.
generated correctly.

## Step 2 - Update the version on `package.json`
Please open a Pull Request with the file changes and wait for the test pipeline before merging it
to main. Make sure to use [Conventional Commit messages]([2]) to help automating the process.

The Pull Request with the changes to the generated files should update the version on `package.json`
following [Semantic Versioning][2] practices - most changes here should be backwards compatible and
deserve a MINOR version update
## Step 2 - Merge the Release Please Pull Request

## Step 3 - Publish a new release on GitHub
[Release Please](https://github.com/googleapis/release-please) will maintain a "Release PR" that
consolidates updates to `CHANGELOG.md` (based on the git history) and updating the `package.json`
file.

The [publish.yml](.github/workflows/publish.yml) workflow is responsible for publishing the package to
NPM when a new release is published on GitHub.
When ready to publish a release, merge the Release PR and the [release.yml]
(.github/workflows/release.yml) workflow will publish a new package to NPM and create a release on GitHub.

[1]: https://openapi-generator.tech
[2]: https://semver.org
[2]: https://www.conventionalcommits.org/en/v1.0.0/
Loading

0 comments on commit 73fce2d

Please sign in to comment.