Skip to content

feat: add npm package #4

feat: add npm package

feat: add npm package #4

Workflow file for this run

# GENERATED BY ./ci.ts -- DO NOT DIRECTLY EDIT
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '*'
concurrency:
group: '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}'
cancel-in-progress: true
jobs:
build:
name: '${{ matrix.config.target }}'
runs-on: '${{ matrix.config.os }}'
strategy:
matrix:
config:
- os: macos-15-intel
run_tests: 'true'
target: x86_64-apple-darwin
cross: 'false'
- os: macos-latest
run_tests: 'true'
target: aarch64-apple-darwin
cross: 'false'
- os: windows-latest
run_tests: 'true'
target: x86_64-pc-windows-msvc
cross: 'false'
- os: ubuntu-22.04
run_tests: 'true'
target: x86_64-unknown-linux-gnu
cross: 'false'
- os: ubuntu-22.04
run_tests: 'false'
target: x86_64-unknown-linux-musl
cross: 'false'
- os: ubuntu-22.04
run_tests: 'false'
target: aarch64-unknown-linux-gnu
cross: 'false'
- os: ubuntu-22.04
run_tests: 'false'
target: aarch64-unknown-linux-musl
cross: 'false'
- os: ubuntu-22.04
run_tests: 'false'
target: riscv64gc-unknown-linux-gnu
cross: 'true'
- os: ubuntu-22.04
run_tests: 'false'
target: loongarch64-unknown-linux-gnu
cross: 'true'
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
outputs:
ZIP_CHECKSUM_X86_64_APPLE_DARWIN: '${{ steps.pre_release_x86_64_apple_darwin.outputs.ZIP_CHECKSUM }}'
ZIP_CHECKSUM_AARCH64_APPLE_DARWIN: '${{ steps.pre_release_aarch64_apple_darwin.outputs.ZIP_CHECKSUM }}'
ZIP_CHECKSUM_X86_64_PC_WINDOWS_MSVC: '${{ steps.pre_release_x86_64_pc_windows_msvc.outputs.ZIP_CHECKSUM }}'
ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_GNU: '${{ steps.pre_release_x86_64_unknown_linux_gnu.outputs.ZIP_CHECKSUM }}'
ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_MUSL: '${{ steps.pre_release_x86_64_unknown_linux_musl.outputs.ZIP_CHECKSUM }}'
ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_GNU: '${{ steps.pre_release_aarch64_unknown_linux_gnu.outputs.ZIP_CHECKSUM }}'
ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_MUSL: '${{ steps.pre_release_aarch64_unknown_linux_musl.outputs.ZIP_CHECKSUM }}'
ZIP_CHECKSUM_RISCV64GC_UNKNOWN_LINUX_GNU: '${{ steps.pre_release_riscv64gc_unknown_linux_gnu.outputs.ZIP_CHECKSUM }}'
ZIP_CHECKSUM_LOONGARCH64_UNKNOWN_LINUX_GNU: '${{ steps.pre_release_loongarch64_unknown_linux_gnu.outputs.ZIP_CHECKSUM }}'
steps:
- name: Prepare git
run: |-
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v6
- uses: dsherret/rust-toolchain-file@v1
- name: Cache cargo
uses: Swatinem/rust-cache@v2
if: '!startsWith(github.ref, ''refs/tags/'')'
with:
key: '${{ matrix.config.target }}'
- uses: denoland/setup-deno@v2
- name: Setup (Linux x86_64-musl)
if: matrix.config.target == 'x86_64-unknown-linux-musl'
run: |-
sudo apt update
sudo apt install musl musl-dev musl-tools
rustup target add x86_64-unknown-linux-musl
- name: Setup (Linux aarch64)
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: |-
sudo apt update
sudo apt install -y gcc-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
- name: Setup (Linux aarch64-musl)
if: matrix.config.target == 'aarch64-unknown-linux-musl'
run: |-
sudo apt update
sudo apt install gcc-aarch64-linux-gnu musl musl-dev musl-tools
rustup target add aarch64-unknown-linux-musl
- name: Setup cross
if: matrix.config.cross == 'true'
run: 'cargo install cross --git https://github.com/cross-rs/cross --rev 4090beca3cfffa44371a5bba524de3a578aa46c3'
- name: Build (Debug)
if: 'matrix.config.cross != ''true'' && !startsWith(github.ref, ''refs/tags/'')'
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: 'cargo build --locked --all-targets --target ${{matrix.config.target}}'
- name: Build release
if: 'matrix.config.cross != ''true'' && startsWith(github.ref, ''refs/tags/'')'
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: 'cargo build --locked --all-targets --target ${{matrix.config.target}} --release'
- name: Build cross (Debug)
if: 'matrix.config.cross == ''true'' && !startsWith(github.ref, ''refs/tags/'')'
run: 'cross build --locked --target ${{matrix.config.target}}'
- name: Build cross (Release)
if: 'matrix.config.cross == ''true'' && startsWith(github.ref, ''refs/tags/'')'
run: 'cross build --locked --target ${{matrix.config.target}} --release'
- name: Lint
if: '!startsWith(github.ref, ''refs/tags/'') && matrix.config.target == ''x86_64-unknown-linux-gnu'''
run: cargo clippy
- name: Lint workflow generation
if: '!startsWith(github.ref, ''refs/tags/'') && matrix.config.target == ''x86_64-unknown-linux-gnu'''
run: |-
deno run -A .github/workflows/ci.ts --lint
deno run -A .github/workflows/release.ts --lint
- name: Test (Debug)
if: 'matrix.config.run_tests == ''true'' && !startsWith(github.ref, ''refs/tags/'')'
run: cargo test --locked --all-features
- name: Test (Release)
if: 'matrix.config.run_tests == ''true'' && startsWith(github.ref, ''refs/tags/'')'
run: cargo test --locked --all-features --release
- name: Pre-release (x86_64-apple-darwin)
id: pre_release_x86_64_apple_darwin
if: 'matrix.config.target == ''x86_64-apple-darwin'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/x86_64-apple-darwin/release
zip -r dprint-plugin-exec-x86_64-apple-darwin.zip dprint-plugin-exec
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-x86_64-apple-darwin.zip | awk '{print $1}')"
- name: Pre-release (aarch64-apple-darwin)
id: pre_release_aarch64_apple_darwin
if: 'matrix.config.target == ''aarch64-apple-darwin'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/aarch64-apple-darwin/release
zip -r dprint-plugin-exec-aarch64-apple-darwin.zip dprint-plugin-exec
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-aarch64-apple-darwin.zip | awk '{print $1}')"
- name: Pre-release (x86_64-pc-windows-msvc)
id: pre_release_x86_64_pc_windows_msvc
if: 'matrix.config.target == ''x86_64-pc-windows-msvc'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
Compress-Archive -CompressionLevel Optimal -Force -Path target/x86_64-pc-windows-msvc/release/dprint-plugin-exec.exe -DestinationPath target/x86_64-pc-windows-msvc/release/dprint-plugin-exec-x86_64-pc-windows-msvc.zip
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 target/x86_64-pc-windows-msvc/release/dprint-plugin-exec-x86_64-pc-windows-msvc.zip | awk '{print $1}')"
- name: Pre-release (x86_64-unknown-linux-gnu)
id: pre_release_x86_64_unknown_linux_gnu
if: 'matrix.config.target == ''x86_64-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/x86_64-unknown-linux-gnu/release
zip -r dprint-plugin-exec-x86_64-unknown-linux-gnu.zip dprint-plugin-exec
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-x86_64-unknown-linux-gnu.zip | awk '{print $1}')"
- name: Pre-release (x86_64-unknown-linux-musl)
id: pre_release_x86_64_unknown_linux_musl
if: 'matrix.config.target == ''x86_64-unknown-linux-musl'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/x86_64-unknown-linux-musl/release
zip -r dprint-plugin-exec-x86_64-unknown-linux-musl.zip dprint-plugin-exec
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-x86_64-unknown-linux-musl.zip | awk '{print $1}')"
- name: Pre-release (aarch64-unknown-linux-gnu)
id: pre_release_aarch64_unknown_linux_gnu
if: 'matrix.config.target == ''aarch64-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/aarch64-unknown-linux-gnu/release
zip -r dprint-plugin-exec-aarch64-unknown-linux-gnu.zip dprint-plugin-exec
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-aarch64-unknown-linux-gnu.zip | awk '{print $1}')"
- name: Pre-release (aarch64-unknown-linux-musl)
id: pre_release_aarch64_unknown_linux_musl
if: 'matrix.config.target == ''aarch64-unknown-linux-musl'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/aarch64-unknown-linux-musl/release
zip -r dprint-plugin-exec-aarch64-unknown-linux-musl.zip dprint-plugin-exec
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-aarch64-unknown-linux-musl.zip | awk '{print $1}')"
- name: Pre-release (riscv64gc-unknown-linux-gnu)
id: pre_release_riscv64gc_unknown_linux_gnu
if: 'matrix.config.target == ''riscv64gc-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/riscv64gc-unknown-linux-gnu/release
zip -r dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip dprint-plugin-exec
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip | awk '{print $1}')"
- name: Pre-release (loongarch64-unknown-linux-gnu)
id: pre_release_loongarch64_unknown_linux_gnu
if: 'matrix.config.target == ''loongarch64-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/loongarch64-unknown-linux-gnu/release
zip -r dprint-plugin-exec-loongarch64-unknown-linux-gnu.zip dprint-plugin-exec
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-loongarch64-unknown-linux-gnu.zip | awk '{print $1}')"
- name: Upload artifacts (x86_64-apple-darwin)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''x86_64-apple-darwin'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: x86_64-apple-darwin-artifacts
path: target/x86_64-apple-darwin/release/dprint-plugin-exec-x86_64-apple-darwin.zip
- name: Upload artifacts (aarch64-apple-darwin)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''aarch64-apple-darwin'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: aarch64-apple-darwin-artifacts
path: target/aarch64-apple-darwin/release/dprint-plugin-exec-aarch64-apple-darwin.zip
- name: Upload artifacts (x86_64-pc-windows-msvc)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''x86_64-pc-windows-msvc'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: x86_64-pc-windows-msvc-artifacts
path: target/x86_64-pc-windows-msvc/release/dprint-plugin-exec-x86_64-pc-windows-msvc.zip
- name: Upload artifacts (x86_64-unknown-linux-gnu)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''x86_64-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: x86_64-unknown-linux-gnu-artifacts
path: target/x86_64-unknown-linux-gnu/release/dprint-plugin-exec-x86_64-unknown-linux-gnu.zip
- name: Upload artifacts (x86_64-unknown-linux-musl)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''x86_64-unknown-linux-musl'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: x86_64-unknown-linux-musl-artifacts
path: target/x86_64-unknown-linux-musl/release/dprint-plugin-exec-x86_64-unknown-linux-musl.zip
- name: Upload artifacts (aarch64-unknown-linux-gnu)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''aarch64-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: aarch64-unknown-linux-gnu-artifacts
path: target/aarch64-unknown-linux-gnu/release/dprint-plugin-exec-aarch64-unknown-linux-gnu.zip
- name: Upload artifacts (aarch64-unknown-linux-musl)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''aarch64-unknown-linux-musl'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: aarch64-unknown-linux-musl-artifacts
path: target/aarch64-unknown-linux-musl/release/dprint-plugin-exec-aarch64-unknown-linux-musl.zip
- name: Upload artifacts (riscv64gc-unknown-linux-gnu)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''riscv64gc-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: riscv64gc-unknown-linux-gnu-artifacts
path: target/riscv64gc-unknown-linux-gnu/release/dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip
- name: Upload artifacts (loongarch64-unknown-linux-gnu)
uses: actions/upload-artifact@v7
if: 'matrix.config.target == ''loongarch64-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')'
with:
name: loongarch64-unknown-linux-gnu-artifacts
path: target/loongarch64-unknown-linux-gnu/release/dprint-plugin-exec-loongarch64-unknown-linux-gnu.zip
draft_release:
name: draft_release
needs:
- build
if: 'startsWith(github.ref, ''refs/tags/'')'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v8
- uses: denoland/setup-deno@v2
- uses: actions/setup-node@v6
with:
node-version: 24.x
registry-url: 'https://registry.npmjs.org'
- name: Move downloaded artifacts to root directory
run: |-
mv x86_64-apple-darwin-artifacts/dprint-plugin-exec-x86_64-apple-darwin.zip .
mv aarch64-apple-darwin-artifacts/dprint-plugin-exec-aarch64-apple-darwin.zip .
mv x86_64-pc-windows-msvc-artifacts/dprint-plugin-exec-x86_64-pc-windows-msvc.zip .
mv x86_64-unknown-linux-gnu-artifacts/dprint-plugin-exec-x86_64-unknown-linux-gnu.zip .
mv x86_64-unknown-linux-musl-artifacts/dprint-plugin-exec-x86_64-unknown-linux-musl.zip .
mv aarch64-unknown-linux-gnu-artifacts/dprint-plugin-exec-aarch64-unknown-linux-gnu.zip .
mv aarch64-unknown-linux-musl-artifacts/dprint-plugin-exec-aarch64-unknown-linux-musl.zip .
mv riscv64gc-unknown-linux-gnu-artifacts/dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip .
mv loongarch64-unknown-linux-gnu-artifacts/dprint-plugin-exec-loongarch64-unknown-linux-gnu.zip .
- name: Output checksums
run: |-
echo "dprint-plugin-exec-x86_64-apple-darwin.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_X86_64_APPLE_DARWIN }}"
echo "dprint-plugin-exec-aarch64-apple-darwin.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_AARCH64_APPLE_DARWIN }}"
echo "dprint-plugin-exec-x86_64-pc-windows-msvc.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_X86_64_PC_WINDOWS_MSVC }}"
echo "dprint-plugin-exec-x86_64-unknown-linux-gnu.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_GNU }}"
echo "dprint-plugin-exec-x86_64-unknown-linux-musl.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_MUSL }}"
echo "dprint-plugin-exec-aarch64-unknown-linux-gnu.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_GNU }}"
echo "dprint-plugin-exec-aarch64-unknown-linux-musl.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_MUSL }}"
echo "dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_RISCV64GC_UNKNOWN_LINUX_GNU }}"
echo "dprint-plugin-exec-loongarch64-unknown-linux-gnu.zip: ${{ needs.build.outputs.ZIP_CHECKSUM_LOONGARCH64_UNKNOWN_LINUX_GNU }}"
- name: Create plugin file
run: deno run --allow-read=. --allow-write=. scripts/create_plugin_file.ts
- name: Get tag version
id: get_tag_version
run: 'echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}'
- name: Get plugin file checksum
id: get_plugin_file_checksum
run: 'echo "::set-output name=CHECKSUM::$(shasum -a 256 plugin.json | awk ''{print $1}'')"'
- name: Update Config Schema Version
run: 'sed -i ''s/exec\/0.0.0/exec\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/'' deployment/schema.json'
- name: Build npm packages
run: deno run -A scripts/create_npm_packages.ts
- name: Create release notes
run: 'deno run -A ./scripts/generate_release_notes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} ${{ steps.get_plugin_file_checksum.outputs.CHECKSUM }} > ${{ github.workspace }}-CHANGELOG.txt'
- name: Release
uses: softprops/action-gh-release@v2.6.1
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
files: |-
dprint-plugin-exec-x86_64-apple-darwin.zip
dprint-plugin-exec-aarch64-apple-darwin.zip
dprint-plugin-exec-x86_64-pc-windows-msvc.zip
dprint-plugin-exec-x86_64-unknown-linux-gnu.zip
dprint-plugin-exec-x86_64-unknown-linux-musl.zip
dprint-plugin-exec-aarch64-unknown-linux-gnu.zip
dprint-plugin-exec-aarch64-unknown-linux-musl.zip
dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip
dprint-plugin-exec-loongarch64-unknown-linux-gnu.zip
plugin.json
deployment/schema.json
body_path: '${{ github.workspace }}-CHANGELOG.txt'
- name: Publish npm packages
run: deno run -A scripts/publish_npm_packages.ts