Skip to content

Release Nightly

Release Nightly #240

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"
jobs:
build:
name: Build Nightly
strategy:
fail-fast: false # Build and test everything so we can look at all the errors
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- i686-pc-windows-msvc
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
uses: ./.github/workflows/reusable-build.yml
with:
target: ${{ matrix.target }}
release:
name: Release Nightly
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Main Branch
uses: actions/checkout@v3
- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache
- name: Download artifacts
uses: actions/download-artifact@v3
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: ${{ always() && !contains(needs.*.result, 'failure') }}
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.ECOSYSTEM_CI_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: '-'
}
});
console.log(result);
notify:
name: Notify if failed
needs: [release]
runs-on: ubuntu-latest
if: ${{ always() && contains(needs.*.result, 'failure') }}
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.RSPACK_BOT_ACCESS_TOKEN }}
script: |
const res = await fetch(
'${{secrets.DISCORD_WEBHOOK_URL}}',
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
username: "nightly release",
avatar_url:
"https://raw.githubusercontent.com/web-infra-dev/rspack-website/main/docs/public/logo.png",
embeds: [
{
title: "nightly release failed",
description: "See job:\n* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
})
}
);
console.log("res:", await res.text());