Skip to content

Commit

Permalink
[JUG-2] - Automate release creation and changelog (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
kin0992 authored Jun 23, 2023
1 parent a8b75f7 commit 3589da0
Show file tree
Hide file tree
Showing 10 changed files with 13,255 additions and 10,052 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/gorgeous-dryers-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pagopa-dev/juggler': minor
---

Create changelog workflow
5 changes: 5 additions & 0 deletions .changeset/lemon-stingrays-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pagopa-dev/juggler': minor
---

Add workflow to create a GitHub release
5 changes: 5 additions & 0 deletions .changeset/slow-geese-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pagopa-dev/juggler': minor
---

Add changeset
41 changes: 41 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Changelog

on:
push:
branches:
- main # Triggered by push on main
paths:
- .changeset/** # Only on changes to ./changeset/*

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
changelog:
name: Update CHANGELOG
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab

- name: Setup Node.js environment
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version-file: ".node-version"
cache: 'npm'
cache-dependency-path: |
package-lock.json
package.json
- name: Install dependencies
run: npm ci

- name: Create next release's PR
id: changesets
uses: changesets/action@d89c1de63c7f28ac47ec85ed395f5f1d045d4697
with:
# Note: npm install after versioning is necessary to refresh package-lock.json file
version: npm run version
commit: "Update CHANGELOG and prepare next release"
title: "Bump version"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/github-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: GitHub Release

on:
push:
tags:
- "*"

jobs:
github_release:
name: GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab

- name: Create GitHub release
uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d
with:
draft: false
generate_release_notes: true
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@ docker run -p 3000:3000 -e OPENAPI_URL=path-to-your-openapi ghcr.io/pagopa/juggl

## Examples
You can find some examples on [./docs/examples/README.md](./docs/examples/README.md) file.

## Changelog

To generate the changelog, we are using [changesets](https://github.com/changesets/changesets).
When you want to add some information you want to show into the changelog, you can run `npx changeset` or `npm run changeset`
and follow the wizard: changeset will ask you what kind of changes you made (major, minor, patch) and also a summary;
the text you enter the summary is what will be visible into the CHANGELOG file.

The `.github/workflows/changelog.yaml` workflow is an action that uses the [changeset's action](https://github.com/changesets/action)
we use to convert the changes tracked with `npm run changeset` into a `CHANGELOG.md` file.
It will, then, create a PR with the proposed changes (it will bump the version, update the `CHANGELOG.md` file, ...).
If many changes happen when that PR is open, changeset's bot automatically updates it according to the changes (it looks to
the `.changeset` folder).
Loading

0 comments on commit 3589da0

Please sign in to comment.