lightweight-sdk-web-component/.github/workflows/relase.yml
2024-11-09 10:38:36 +01:00

56 lines
1.6 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
# 7. Check generated files
- name: List files in the workspace
run: ls -la
- name: Get Name of Artifact
run: |
ARTIFACT_PATHNAME=$(ls *.tgz | head -n 1)
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME)
echo ::set-env name=ARTIFACT_NAME::${ARTIFACT_NAME}
echo ::set-env name=ARTIFACT_PATHNAME::${ARTIFACT_PATHNAME}
# 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: ${{ env.ARTIFACT_PATHNAME }}
asset_name: ${{ env.ARTIFACT_NAME }}
asset_content_type: application/gzip