From 6927a7703b4986d937c9a9433fd6155ae3383b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Pichon?= Date: Thu, 21 Nov 2024 12:14:40 +0100 Subject: [PATCH] ci: add prerelease workflow --- .github/workflows/checks.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/prerelease.yml | 42 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 4 +-- .gitignore | 1 + lerna.json | 2 +- package.json | 4 ++- 7 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/prerelease.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c96aa74..d3dbd11 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -14,7 +14,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'chore: release')" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} - name: Setup diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f25deec..021fcb5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,7 +11,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'chore: release')" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} - name: Setup diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 0000000..4c17a04 --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,42 @@ +name: Prerelease + +on: + workflow_dispatch: + inputs: + branch: + type: string + description: 'Branch to prerelease from' + required: true + default: 'master' + +jobs: + prerelease: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch }} + token: ${{ secrets.GH_TOKEN }} + fetch-depth: 0 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '18.13.0' + registry-url: 'https://registry.npmjs.org' + - name: Setup Git + run: | + git config --global user.email "action@github.com" + git config --global user.name "Github Action" + - name: Setup NPM + run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Install + run: npm ci + - name: Build + run: npm run build -- --projects vertis + - name: Version + run: npm run version:prerelease + - name: Publish + run: npm run publish:prerelease diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70fe60d..5997b22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,8 +7,8 @@ jobs: release: runs-on: ubuntu-20.04 steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} fetch-depth: 0 diff --git a/.gitignore b/.gitignore index 97a483b..5cd40a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +/.nx/ /node_modules /.npmrc diff --git a/lerna.json b/lerna.json index 42267b8..ec7f2a1 100644 --- a/lerna.json +++ b/lerna.json @@ -18,4 +18,4 @@ "yes": true } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 177832d..adc5eeb 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "shared/*" ], "scripts": { - "prepare": "husky install && npm run build", + "prepare": "husky install", "commit": "cz", "commitlint": "commitlint --edit", "dev": "nx run-many -t dev --output-style=stream", @@ -17,8 +17,10 @@ "preview": "nx preview docs", "exec": "node ./packages/vertis/cli.js", "version": "lerna version", + "version:prerelease": "lerna version --conventional-prerelease", "changelog": "vertis generate", "publish": "lerna publish from-package", + "publish:prerelease": "lerna publish from-package --canary", "release": "vertis release" }, "devDependencies": {