Pre-release CI #29
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
name: Pre-release CI | |
on: | |
workflow_run: | |
workflows: [Quality Checks] | |
types: | |
- completed | |
jobs: | |
build: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18, 19, 20, 21, 22] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Common Setup Node ${{ matrix.node-version }} and pnpm | |
uses: ./.github/actions/common-setup | |
with: | |
pnpm-version: 10.2.0 | |
node-version: ${{ matrix.node-version }} | |
cache: pnpm | |
- name: Build | |
run: | | |
pnpm install --frozen-lockfile --prefer-offline | |
pnpm run build | |
env: | |
CI: true | |
package: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Common Setup | |
uses: ./.github/actions/common-setup | |
with: | |
pnpm-version: 10.2.0 | |
node-version: 22.x | |
cache: pnpm | |
- name: Change package name to scoped package | |
run: pnpm pkg set name=@younis-ahmed/qwen-ai-provider && pnpm pkg set publishConfig.registry=https://npm.pkg.github.com/ | |
- run: pnpm install --frozen-lockfile --prefer-offline | |
- run: pnpm run build | |
- run: pnpm version prerelease --preid=preRel-$GITHUB_RUN_ID --no-git-tag-version | |
- run: pnpm pack | |
- name: Upload package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: package | |
path: "*.tgz" | |
publish: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} && github.repository_owner == 'Younis-ahmed' && github.ref == 'refs/heads/main' | |
name: Publish to GitHub Packages | |
needs: package | |
runs-on: ubuntu-latest | |
environment: | |
name: production # This sets up a manual approval gate for production | |
steps: | |
- name: Download Package Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: package | |
- name: Setup Node for Publishing | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
registry-url: https://npm.pkg.github.com/ | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10.2.0 | |
- name: Authenticate to GitHub Packages | |
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Publish Package | |
run: pnpm publish $(ls *.tgz) | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |