Skip to content

Commit 01a27fa

Browse files
committed
pkg: publish first rc
1 parent d99c955 commit 01a27fa

File tree

5 files changed

+134
-3
lines changed

5 files changed

+134
-3
lines changed

.github/dependabot.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: 'npm' # See documentation for possible values
9+
directory: '/' # Location of package manifests
10+
target-branch: 'preprod'
11+
schedule:
12+
interval: 'daily'
13+
groups:
14+
publicodes-dependencies:
15+
patterns:
16+
- '@incubateur-ademe/*'
17+
- '@publicodes/*'
18+
- 'publicodes'
19+
dev-dependencies:
20+
patterns:
21+
- 'prettier'
22+
allow:
23+
- dependency-name: publicodes-dependencies
24+
ignore:
25+
- dependency-name: dev-dependencies
26+
labels:
27+
- 'dependencies'

.github/workflows/packaging.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: GitHub release and NPM publishing
2+
3+
# From: https://github.com/garronej/ts-ci
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
check_if_version_upgraded:
11+
name: Check if version upgrade
12+
# When someone forks the repo and opens a PR we want to enables the tests to be run (the previous jobs)
13+
# but obviously only us should be allowed to release.
14+
# In the following check we make sure that we own the branch this CI workflow is running on before continuing.
15+
# Without this check, trying to release would fail anyway because only us have the correct secret.NPM_TOKEN but
16+
# it's cleaner to stop the execution instead of letting the CI crash.
17+
if: |
18+
github.event_name == 'push' ||
19+
github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
20+
runs-on: ubuntu-latest
21+
outputs:
22+
from_version: ${{ steps.step1.outputs.from_version }}
23+
to_version: ${{ steps.step1.outputs.to_version }}
24+
is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }}
25+
is_pre_release: ${{steps.step1.outputs.is_pre_release }}
26+
steps:
27+
- uses: garronej/ts-ci@v2.1.0
28+
id: step1
29+
with:
30+
action_name: is_package_json_version_upgraded
31+
branch: ${{ github.head_ref || github.ref }}
32+
33+
create_github_release:
34+
runs-on: ubuntu-latest
35+
# We create release only if the version in the package.json have been
36+
# upgraded and this CI is running against the main branch. We allow
37+
# branches with a PR open on main to publish pre-release (x.y.z-rc.u) but
38+
# not actual releases.
39+
if: |
40+
needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' &&
41+
(
42+
github.event_name == 'push' ||
43+
needs.check_if_version_upgraded.outputs.is_pre_release == 'true'
44+
)
45+
needs:
46+
- check_if_version_upgraded
47+
steps:
48+
- uses: softprops/action-gh-release@v1
49+
with:
50+
name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }}
51+
tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }}
52+
target_commitish: ${{ github.head_ref || github.ref }}
53+
generate_release_notes: true
54+
draft: false
55+
prerelease: ${{ needs.check_if_version_upgraded.outputs.is_pre_release == 'true'}}
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
59+
# deploy_gh_page:
60+
# runs-on: ubuntu-latest
61+
# needs:
62+
# - create_github_release
63+
# - check_if_version_upgraded
64+
# steps:
65+
# - name: Checkout
66+
# uses: actions/checkout@v3
67+
# - name: Install dependencies and build
68+
# run: yarn install --immutable && yarn install --immutable --cwd doc
69+
# - run: yarn run doc:build
70+
# - name: Deploy
71+
# uses: crazy-max/ghaction-github-pages@v3
72+
# with:
73+
# target_branch: gh-pages
74+
# build_dir: doc/build
75+
# jekyll: false
76+
# env:
77+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
79+
publish_on_npm:
80+
runs-on: ubuntu-latest
81+
needs:
82+
- create_github_release
83+
- check_if_version_upgraded
84+
steps:
85+
- uses: actions/checkout@v3
86+
with:
87+
ref: ${{ github.ref }}
88+
- name: Setup .npmrc file to publish to npm
89+
uses: actions/setup-node@v3
90+
with:
91+
node-version: 22
92+
registry-url: "https://registry.npmjs.org"
93+
- name: Install dependencies
94+
run: yarn install --immutable
95+
- name: Prepare packaging
96+
run: yarn prepack
97+
- name: Publish to NPM
98+
run: npm publish
99+
env:
100+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
node_modules
2-
publicodes-build
2+
publicodes-build
3+
publicodes-acv-numerique.model.json
4+
index.d.ts
5+
index.js

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "publicodes-acv-numerique",
2+
"name": "@incubateur-ademe/publicodes-acv-numerique",
33
"description": "Modèle Publicodes de la base de données ACV ADEME sur le numérique",
44
"version": "2.0.0-rc.1",
55
"author": "Clément Auger",
@@ -14,7 +14,8 @@
1414
"compile": "publicodes compile",
1515
"dev": "publicodes dev",
1616
"pretest": "yarn run compile",
17-
"test": "vitest run"
17+
"test": "vitest run",
18+
"prepack": "yarn compile && cp publicodes-build/* ./"
1819
},
1920
"peerDependencies": {
2021
"publicodes": "^1.8.5"
File renamed without changes.

0 commit comments

Comments
 (0)