Skip to content

Commit

Permalink
feat(sematic-release): add dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebigard committed Nov 10, 2021
1 parent f31ad54 commit 67b500a
Show file tree
Hide file tree
Showing 5 changed files with 3,121 additions and 47 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Bump develop
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-
- name: Run Yarn Install
run: |
cd ui
yarn install
- name: bump
run: |
cd ui
yarn npm:release
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
}
},
"lint-staged": {
"*.js": [
"*.{js,jsx,ts,tsx}": [
"eslint --cache --fix",
"prettier --write"
]
Expand Down
8 changes: 7 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "mna-cerfa-ui",
"description": "[MNA] Générateur Cerfa UI",
"repository": "https://github.com/mission-apprentissage/cerfa.git",
"version": "0.1.0",
"author": "MNA",
"license": "MIT",
Expand All @@ -15,13 +16,16 @@
"formik": "2.1.4",
"framer-motion": "^4",
"jsonwebtoken": "8.5.1",
"lint-staged": "11.2.6",
"moment": "2.27.0",
"query-string": "6.13.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-hooks-global-state": "1.0.0",
"react-router-dom": "5.2.0",
"react-scripts": "3.4.1",
"semantic-release": "18.0.0",
"semantic-release-slack-bot": "2.1.2",
"styled-components": "5.1.1",
"tabler-react": "1.30.1",
"yup": "0.29.1"
Expand All @@ -30,7 +34,9 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"npm:release": "semantic-release",
"npm:release:local": "CI=true LOCAL_RELEASE=true semantic-release"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
64 changes: 64 additions & 0 deletions ui/release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const mainConfig = {
branches: [
"main",
{ name: "develop", channel: "beta", prerelease: "beta" },
],
repositoryUrl: "https://github.com/mission-apprentissage/cerfa.git",
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
},
],
"@semantic-release/npm",
[
"@semantic-release/git",
{
assets: ["CHANGELOG.md"],
message:
// eslint-disable-next-line no-template-curly-in-string
"chore(release): ${nextRelease.version}",
},
],
"@semantic-release/github",
[
"@semantic-release/exec",
{
publishCmd: "git checkout -- package.json",
},
],
[
"semantic-release-slack-bot",
{
notifyOnSuccess: true,
notifyOnFail: true,
markdownReleaseNotes: true,
},
],
],
};

const { execSync } = require("child_process");
const { createHash } = require("crypto");

const branch = execSync("git branch --show-current").toString().trimEnd("\n");
const channel = createHash("md5").update(branch).digest("hex");

const localConfig = {
branches: [
"main",
{ name: "develop", channel: "beta", prerelease: "beta" },
{
name: branch,
channel,
prerelease: channel,
},
],
repositoryUrl: "https://github.com/mission-apprentissage/cerfa.git",
plugins: ["@semantic-release/commit-analyzer", "@semantic-release/npm"],
};

module.exports = process.env.LOCAL_RELEASE ? localConfig : mainConfig;
Loading

0 comments on commit 67b500a

Please sign in to comment.