From 25e634cbf72966ed9ef5b34597c2fe65f8841a6a Mon Sep 17 00:00:00 2001 From: kyuno053 <31762247+kyuno053@users.noreply.github.com> Date: Fri, 8 Nov 2024 19:18:36 +0100 Subject: [PATCH 1/7] Create release-local.yml --- .github/workflows/release-local.yml | 62 +++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/release-local.yml diff --git a/.github/workflows/release-local.yml b/.github/workflows/release-local.yml new file mode 100644 index 0000000..bcf830d --- /dev/null +++ b/.github/workflows/release-local.yml @@ -0,0 +1,62 @@ +name: Release + +# Déclenchement du workflow à chaque création de tag +on: + push: + tags: + - 'v*' # Déclenche pour chaque tag commençant par 'v' (ex: v1.0.0) + +jobs: + release: + runs-on: ubuntu-latest + + steps: + # Étape 1: Vérifier le code + - name: Checkout code + uses: actions/checkout@v2 + + # Étape 2: Installer Node.js + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '16' # Remplace par la version Node.js souhaitée + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 7 + run_install: | + - recursive: true + - args: [--global, rimraf, typescript] + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + # Étape 4: Lancer la compilation + - name: Build + run: pnpm build + + # Étape 5: Créer une release sur GitHub + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} # Utilise le tag actuel comme nom de la release + release_name: "Release ${{ github.ref_name }}" + body: "Automated release for version ${{ github.ref_name }}" + draft: false + prerelease: false From f4e48861247b8b002cc763212d74efdfbae73b8f Mon Sep 17 00:00:00 2001 From: kyuno053 <31762247+kyuno053@users.noreply.github.com> Date: Fri, 8 Nov 2024 19:21:55 +0100 Subject: [PATCH 2/7] Update release-local.yml --- .github/workflows/release-local.yml | 53 +++++++++++++---------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release-local.yml b/.github/workflows/release-local.yml index bcf830d..9a06f6e 100644 --- a/.github/workflows/release-local.yml +++ b/.github/workflows/release-local.yml @@ -1,6 +1,5 @@ name: Release -# Déclenchement du workflow à chaque création de tag on: push: tags: @@ -15,41 +14,24 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - # Étape 2: Installer Node.js - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: '16' # Remplace par la version Node.js souhaitée - - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: 7 - run_install: | - - recursive: true - - args: [--global, rimraf, typescript] - - - name: Get pnpm store directory - shell: bash + # Étape 2: Installer pnpm + - name: Install pnpm run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + npm install -g pnpm # Installe pnpm globalement + # Étape 3: Installer les dépendances avec pnpm - name: Install dependencies run: pnpm install - # Étape 4: Lancer la compilation - - name: Build - run: pnpm build + # Étape 4: Construire la librairie avec pnpm + - name: Build library + run: pnpm run build # Remplace par ton script de build si nécessaire - # Étape 5: Créer une release sur GitHub + # Étape 5: Lancer les tests avec pnpm + - name: Run tests + run: pnpm test + + # Étape 6: Créer une release GitHub - name: Create GitHub Release uses: actions/create-release@v1 env: @@ -60,3 +42,14 @@ jobs: body: "Automated release for version ${{ github.ref_name }}" draft: false prerelease: false + + # Étape 7: Ajouter les fichiers de build à la release + - name: Upload build assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create-release.outputs.upload_url }} + asset_path: ./dist # Remplace par le dossier où sont générés tes fichiers buildés + asset_name: "build-${{ github.ref_name }}.zip" + asset_content_type: application/zip From c736273de9c250bd61b2884e747adc681011513f Mon Sep 17 00:00:00 2001 From: kyuno053 <31762247+kyuno053@users.noreply.github.com> Date: Fri, 8 Nov 2024 19:24:49 +0100 Subject: [PATCH 3/7] Update release-local.yml --- .github/workflows/release-local.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-local.yml b/.github/workflows/release-local.yml index 9a06f6e..e2874e6 100644 --- a/.github/workflows/release-local.yml +++ b/.github/workflows/release-local.yml @@ -27,9 +27,9 @@ jobs: - name: Build library run: pnpm run build # Remplace par ton script de build si nécessaire - # Étape 5: Lancer les tests avec pnpm - - name: Run tests - run: pnpm test + # # Étape 5: Lancer les tests avec pnpm + # - name: Run tests + # run: pnpm test # Étape 6: Créer une release GitHub - name: Create GitHub Release From d7d64e888e4abbda6cf02b53a44ae4b31f3f2380 Mon Sep 17 00:00:00 2001 From: kyuno053 <31762247+kyuno053@users.noreply.github.com> Date: Fri, 8 Nov 2024 19:40:31 +0100 Subject: [PATCH 4/7] Update release-local.yml --- .github/workflows/release-local.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-local.yml b/.github/workflows/release-local.yml index e2874e6..37da2cd 100644 --- a/.github/workflows/release-local.yml +++ b/.github/workflows/release-local.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - 'v*' # Déclenche pour chaque tag commençant par 'v' (ex: v1.0.0) + - 'v*' # Déclenche pour chaque tag qui commence par 'v' (ex: v1.0.0) jobs: release: @@ -17,7 +17,7 @@ jobs: # Étape 2: Installer pnpm - name: Install pnpm run: | - npm install -g pnpm # Installe pnpm globalement + npm install -g pnpm # Étape 3: Installer les dépendances avec pnpm - name: Install dependencies @@ -25,7 +25,7 @@ jobs: # Étape 4: Construire la librairie avec pnpm - name: Build library - run: pnpm run build # Remplace par ton script de build si nécessaire + run: pnpm run build # # Étape 5: Lancer les tests avec pnpm # - name: Run tests @@ -33,11 +33,12 @@ jobs: # Étape 6: Créer une release GitHub - name: Create GitHub Release + id: create_release # Ajout d'un ID pour accéder aux sorties uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref_name }} # Utilise le tag actuel comme nom de la release + tag_name: ${{ github.ref_name }} release_name: "Release ${{ github.ref_name }}" body: "Automated release for version ${{ github.ref_name }}" draft: false @@ -49,7 +50,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create-release.outputs.upload_url }} + upload_url: ${{ steps.create_release.outputs.upload_url }} # Utilise l'URL de téléchargement de la release asset_path: ./dist # Remplace par le dossier où sont générés tes fichiers buildés asset_name: "build-${{ github.ref_name }}.zip" asset_content_type: application/zip From bd105f18c34dc0995b0f77d42e3ce88065f8e9a5 Mon Sep 17 00:00:00 2001 From: kyuno053 <31762247+kyuno053@users.noreply.github.com> Date: Fri, 8 Nov 2024 19:43:15 +0100 Subject: [PATCH 5/7] Delete .github/workflows/release-local.yml --- .github/workflows/release-local.yml | 56 ----------------------------- 1 file changed, 56 deletions(-) delete mode 100644 .github/workflows/release-local.yml diff --git a/.github/workflows/release-local.yml b/.github/workflows/release-local.yml deleted file mode 100644 index 37da2cd..0000000 --- a/.github/workflows/release-local.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v*' # Déclenche pour chaque tag qui commence par 'v' (ex: v1.0.0) - -jobs: - release: - runs-on: ubuntu-latest - - steps: - # Étape 1: Vérifier le code - - name: Checkout code - uses: actions/checkout@v2 - - # Étape 2: Installer pnpm - - name: Install pnpm - run: | - npm install -g pnpm - - # Étape 3: Installer les dépendances avec pnpm - - name: Install dependencies - run: pnpm install - - # Étape 4: Construire la librairie avec pnpm - - name: Build library - run: pnpm run build - - # # Étape 5: Lancer les tests avec pnpm - # - name: Run tests - # run: pnpm test - - # Étape 6: Créer une release GitHub - - name: Create GitHub Release - id: create_release # Ajout d'un ID pour accéder aux sorties - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref_name }} - release_name: "Release ${{ github.ref_name }}" - body: "Automated release for version ${{ github.ref_name }}" - draft: false - prerelease: false - - # Étape 7: Ajouter les fichiers de build à la release - - name: Upload build assets - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # Utilise l'URL de téléchargement de la release - asset_path: ./dist # Remplace par le dossier où sont générés tes fichiers buildés - asset_name: "build-${{ github.ref_name }}.zip" - asset_content_type: application/zip From 6d88e66d90e888218381d7e999e732de7740704e Mon Sep 17 00:00:00 2001 From: kyuno053 <31762247+kyuno053@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:05:41 +0100 Subject: [PATCH 6/7] Create relase.yml --- .github/workflows/relase.yml | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/relase.yml diff --git a/.github/workflows/relase.yml b/.github/workflows/relase.yml new file mode 100644 index 0000000..7bdf7d0 --- /dev/null +++ b/.github/workflows/relase.yml @@ -0,0 +1,46 @@ +name: Package TypeScript Library with pnpm + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # 1. Checkout the repository + - name: Checkout repository + uses: actions/checkout@v2 + + # 2. Set up Node.js environment + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '22' # Utilise une version de Node.js compatible avec ton projet + + # 3. Install pnpm + - name: Install pnpm + run: npm install -g pnpm + + # 4. Install dependencies using pnpm + - name: Install dependencies + run: pnpm install + + # 5. Compile TypeScript + - name: Compile TypeScript + run: pnpm run build # Assure-toi que cette commande compile ton projet + + # 6. Package the library with pnpm pack + - name: Create package + run: pnpm pack + # Cette commande crée un fichier .tgz dans le dossier courant avec ta librairie packagée + + # 7. Upload the package as a release asset + - name: Upload release asset + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./*.tgz + asset_name: package_${{ github.event.release.tag_name }}.tgz + asset_content_type: application/gzip From 154981bf9c0ba729ff4bb2bd055f645149a211db Mon Sep 17 00:00:00 2001 From: kyuno053 <31762247+kyuno053@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:10:31 +0100 Subject: [PATCH 7/7] Update relase.yml --- .github/workflows/relase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/relase.yml b/.github/workflows/relase.yml index 7bdf7d0..04d5d7e 100644 --- a/.github/workflows/relase.yml +++ b/.github/workflows/relase.yml @@ -2,7 +2,7 @@ name: Package TypeScript Library with pnpm on: release: - types: [published] + types: [created] jobs: build: