-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👷 Update CI and add Version incrementing
- Loading branch information
Showing
4 changed files
with
69 additions
and
73 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,48 @@ | ||
name: Release | ||
name: Publish GitHub Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
paths: | ||
- '**/*' | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
publish-package: | ||
if: contains(github.event.head_commit.message, 'publish') | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout Repo | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
version: 9 | ||
|
||
- name: Setup Node.js | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
node-version: '22.x' | ||
cache: pnpm | ||
registry-url: https://registry.npmjs.org/ | ||
scope: "@darkmode-code" | ||
|
||
- name: Install Dependencies | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build Project | ||
- name: Build the package | ||
run: pnpm build | ||
|
||
- name: Check for required tokens | ||
run: | | ||
if [ -z "${{ secrets.GITHUB_TOKEN }}" ]; then | ||
echo "GITHUB_TOKEN is not set" | ||
exit 1 | ||
fi | ||
if [ -z "${{ secrets.NPM_TOKEN }}" ]; then | ||
echo "NPM_TOKEN is not set" | ||
exit 1 | ||
fi | ||
- name: Create .npmrc | ||
run: | | ||
cat << EOF > "$HOME/.npmrc" | ||
//registry.npmjs.org/:_authToken=$NPM_TOKEN | ||
EOF | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
|
||
- name: Create Release Pull Request and Publish to npm | ||
id: changesets-production | ||
uses: changesets/action@v1 | ||
with: | ||
publish: pnpm release | ||
- name: Publish to npm | ||
run: pnpm publish --access public | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env node | ||
|
||
import prompts from "prompts"; | ||
import { execSync } from "child_process"; | ||
|
||
(async () => { | ||
const response = await prompts([ | ||
{ | ||
type: "select", | ||
name: "bumpType", | ||
message: "Choisissez le type d'incrémentation de version :", | ||
choices: [ | ||
{ title: "Patch", value: "patch" }, | ||
{ title: "Minor", value: "minor" }, | ||
{ title: "Major", value: "major" }, | ||
], | ||
initial: 0, | ||
}, | ||
{ | ||
type: "text", | ||
name: "description", | ||
message: "Entrez une description pour le commit de version :", | ||
initial: "Nouvelle version", | ||
}, | ||
]); | ||
|
||
const { bumpType, description } = response; | ||
|
||
if (!bumpType) { | ||
console.log("Aucun type de bump sélectionné, opération annulée."); | ||
process.exit(1); | ||
} | ||
|
||
try { | ||
execSync(`pnpm version ${bumpType} -m "publish v%s - ${description}"`, { | ||
stdio: "inherit", | ||
}); | ||
|
||
console.log(`Version incrémentée en ${bumpType} avec succès !`); | ||
} catch (error) { | ||
console.error("Erreur lors de l'incrémentation de la version :", error.message); | ||
process.exit(1); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters