mirror of
https://github.com/swc-project/swc.git
synced 2024-12-28 08:04:43 +03:00
164 lines
4.4 KiB
YAML
164 lines
4.4 KiB
YAML
name: "Publish"
|
|
|
|
env:
|
|
CI: 1
|
|
# 7 GiB by default on GitHub, setting to 6 GiB
|
|
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
|
|
NODE_OPTIONS: --max-old-space-size=6144
|
|
GIT_AUTHOR_NAME: "SWC Bot"
|
|
GIT_AUTHOR_EMAIL: "bot@swc.rs"
|
|
GIT_COMMITTER_NAME: "SWC Bot"
|
|
GIT_COMMITTER_EMAIL: "bot@swc.rs"
|
|
# https://github.com/actions/setup-node/issues/899#issuecomment-1819151595
|
|
SKIP_YARN_COREPACK_CHECK: 1
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to publish"
|
|
required: true
|
|
type: string
|
|
skipBuild:
|
|
description: "Skip build. Used to debug swc-ecosystem-ci."
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
onlyNightly:
|
|
description: "Publish only nightly"
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
allowBreakingWasm:
|
|
description: "Allow breaking changes in wasm"
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
cargo-bump:
|
|
name: "Bump crates"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- name: Install cargo-edit
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-edit@0.12.2
|
|
|
|
- name: Install cargo-edit
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-mono@0.4.1
|
|
|
|
- run: cargo bump
|
|
continue-on-error: true
|
|
|
|
- uses: webfactory/ssh-agent@v0.9.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
|
|
|
|
- name: Push bump commit
|
|
run: |
|
|
git push git@github.com:swc-project/swc.git --no-verify
|
|
|
|
publish-cargo:
|
|
name: "Publish cargo crates"
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- cargo-bump
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/setup-node
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
|
|
- name: Install cargo-edit
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-edit@0.12.2
|
|
|
|
- name: Install cargo-edit
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-mono@0.4.1
|
|
|
|
- name: Update constant of swc_core
|
|
run: npx ts-node .github/bot/src/cargo/update-constants.ts
|
|
|
|
- name: Publish crates
|
|
# Skip on pull requests
|
|
if: github.event_name == 'workflow_dispatch'
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
run: |
|
|
cargo mono publish --no-verify
|
|
|
|
determine-nightly-version:
|
|
name: "Determine nightly version"
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
version: ${{ steps.determine-nightly-version.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-node
|
|
- name: Determine nightly version
|
|
id: determine-nightly-version
|
|
run: |
|
|
npx ts-node .github/bot/src/nightly-version.ts ${{ github.event.inputs.version }} >> $GITHUB_OUTPUT
|
|
|
|
publish-npm-nightly:
|
|
name: "Publish ${{ needs.determine-nightly-version.outputs.version }}"
|
|
needs:
|
|
- publish-cargo
|
|
- determine-nightly-version
|
|
uses: ./.github/workflows/publish-npm-package.yml
|
|
secrets: inherit
|
|
with:
|
|
package: "core"
|
|
version: ${{ needs.determine-nightly-version.outputs.version }}
|
|
buildCli: true
|
|
skipBuild: ${{ inputs.skipBuild || false }}
|
|
skipPublishing: false
|
|
|
|
run-ecosystem-ci-with-nightly:
|
|
name: "Test nightly using ecosystem CI"
|
|
needs:
|
|
- determine-nightly-version
|
|
- publish-npm-nightly
|
|
uses: ./.github/workflows/ecosystem-ci.yml
|
|
with:
|
|
version: ${{ needs.determine-nightly-version.outputs.version }}
|
|
mode: "passing"
|
|
suites: '["_"]'
|
|
allowBreakingWasm: ${{ inputs.allowBreakingWasm || false }}
|
|
|
|
publish-npm-stable:
|
|
name: "Publish ${{ inputs.version || 'stable' }} to npm"
|
|
needs:
|
|
- publish-cargo
|
|
- run-ecosystem-ci-with-nightly
|
|
|
|
uses: ./.github/workflows/publish-npm-package.yml
|
|
secrets: inherit
|
|
with:
|
|
package: "core"
|
|
version: ${{ inputs.version }}
|
|
buildCli: true
|
|
skipBuild: ${{ inputs.skipBuild || inputs.onlyNightly || false }}
|
|
# Skip on pull requests
|
|
skipPublishing: ${{ inputs.onlyNightly }}
|