lightweight-sdk-web-component/.github/workflows/relase.yml
2024-11-09 11:27:31 +01:00

63 lines
1.8 KiB
YAML

name: Package TypeScript Library with pnpm
on:
release:
types: [created]
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
# 8. Upload artifact
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{github.event.repository.name}}${{ github.event.release.tag_name }}
path: ./*.tgz
# 9. Download artifact
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{github.event.repository.name}}${{ github.event.release.tag_name }}
path: release
# 7. Check generated files
- name: List files in the workspace
run: ls -la && cd release && ls -ls
# 8. 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: release
asset_name: ${{github.event.repository.name}}${{ github.event.release.tag_name }}.tgz
asset_content_type: application/gzip