🤖 Automatise la publication du paquet modele-social sur NPM

pull/2012/head
Maxime Quandalle 2022-02-09 15:02:38 +01:00 committed by Maxime Quandalle
parent eb43986058
commit ba4c358452
5 changed files with 48 additions and 3 deletions

26
.github/workflows/publish.yaml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Publish
on:
workflow_run:
workflows: ['Tests']
types: [completed]
jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-20.04
strategy:
# On a seulement 1 paquet donc pas besoin de matrix ici, mais c'est en
# prévision du paquet covid à venir.
matrix:
package: ['modele-social']
steps:
- uses: actions/checkout@v2
- run: yarn install --frozen-lockfile
- run: yarn workspace ${{ matrix.package }} run build
env:
NODE_ENV: production
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_PUBLISH_SECRET }}
dry-run: ${{ github.ref != 'refs/heads/master' }}
package: ./${{ matrix.package }}/package.json

View File

@ -0,0 +1,3 @@
## 0.6.0
Publication du paquet sous forme d'ES modules.

View File

@ -0,0 +1,16 @@
// Ensure that current package version is referenced in the Changelog.md
import { readFileSync } from 'fs'
const packageVersion = JSON.parse(
readFileSync(new URL('./package.json', import.meta.url).pathname)
).version
const changelog = readFileSync(
new URL('./CHANGELOG.md', import.meta.url).pathname
)
if (!changelog.includes(`## ${packageVersion}\n`)) {
throw Error(
`Current version ${packageVersion} is not referenced in the CHANGELOG.md`
)
}

View File

@ -1,6 +1,6 @@
{
"name": "modele-social",
"version": "0.5.0",
"version": "0.6.0",
"description": "Les règles publicodes du système social français",
"main": "./dist/index.js",
"types": "./index.d.ts",
@ -28,6 +28,6 @@
"clean": "rimraf dist node_modules",
"prepare": "yarn run build",
"up": "yarn version --minor && echo \" N'oubliez pas de poussez le tag git\"",
"test": "echo 1"
"test": "node check-changelog.js"
}
}

View File

@ -72,7 +72,7 @@
"algoliasearch": "^4.10.2",
"fuse.js": "^6.4.6",
"markdown-to-jsx": "^7.1.5",
"modele-social": "^0.5.0",
"modele-social": "^0.6.0",
"publicodes": "^1.0.0-beta.30",
"publicodes-react": "^1.0.0-beta.30",
"ramda": "^0.27.0",