Skip to content

Release Nightly

Release Nightly #49

name: Release Nightly
on:
workflow_dispatch:
schedule:
# 08:00 AM Beijing Time. Except Tuesday, which is for full release
- cron: "0 0 * * 0,1,3,4,5,6"
permissions:
# To publish packages with provenance
id-token: write
contents: write
jobs:
get-runner-labels:
name: Get Runner Labels
if: github.repository_owner == 'web-infra-dev'
uses: ./.github/workflows/get-runner-labels.yml
with:
force-use-github-runner: true
build:
name: Build Nightly
if: github.repository_owner == 'web-infra-dev'
needs: [get-runner-labels]
strategy:
fail-fast: false # Build and test everything so we can look at all the errors
matrix:
array:
- target: x86_64-unknown-linux-gnu
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: aarch64-unknown-linux-gnu
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: x86_64-unknown-linux-musl
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: aarch64-unknown-linux-musl
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: i686-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: x86_64-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: aarch64-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: x86_64-apple-darwin
runner: ${{ needs.get-runner-labels.outputs.MACOS_RUNNER_LABELS }}
- target: aarch64-apple-darwin
runner: ${{ needs.get-runner-labels.outputs.MACOS_RUNNER_LABELS }}
uses: ./.github/workflows/reusable-build.yml
with:
target: ${{ matrix.array.target }}
runner: ${{ matrix.array.runner }}
release:
name: Release Nightly
if: github.repository_owner == 'web-infra-dev'
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Main Branch
uses: actions/checkout@v4
- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache
- name: Download artifacts
uses: actions/[email protected]
with:
path: artifacts
- name: Build node packages
run: pnpm run build:js
- name: Move artifacts
run: node scripts/build-npm.cjs
- name: Show binding packages
run: ls -R npm
- name: Resolve dependencies for bindings
run: pnpm install --no-frozen-lockfile
- name: Publish
id: publish
run: |
./x version snapshot
./x publish snapshot --tag nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
REPOSITORY: ${{ github.repository }}
REF: ${{ github.ref }}
ONLY_RELEASE_TAG: true
outputs:
version: ${{ steps.publish.outputs.version }}
trigger-ecosystem-ci:
name: Trigger Ecosystem CI if successed
needs: [release]
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'web-infra-dev' && success() }}
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.RSPACK_ACCESS_TOKEN }}
script: |
const result = await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: 'rspack-ecosystem-ci',
workflow_id: 'ecosystem-ci-selected.yml',
ref: 'main',
inputs: {
refType: 'release',
ref: '${{ needs.release.outputs.version }}',
repo: 'web-infra-dev/rspack',
suite: '-',
suiteRefType: 'precoded',
suiteRef: 'precoded',
}
});
console.log(result);
notify:
name: Notify if failed
needs: [release]
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'web-infra-dev' && failure() && !cancelled() }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- shell: bash
run: ./scripts/alert/lark.js
env:
TITLE: Nightly release failed
DESCRIPTION: |
commitID: [${{github.sha}}](${{github.server_url}}/${{github.repository}}/commit/${{github.sha}})
URL: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
LARK_WEBHOOK_URL: ${{secrets.LARK_WEBHOOK_URL}}