ci: major overhaul
- Simplify some workflow steps and auxiliary scripts - Build library using cmake when not cross-compiling - Try to fetch fixtures from cache first - Use `actions-rust-lang/setup-rust-toolchain`
This commit is contained in:
parent
7715001692
commit
e8e56255bd
11 changed files with 268 additions and 255 deletions
66
.github/workflows/release.yml
vendored
66
.github/workflows/release.yml
vendored
|
|
@ -1,4 +1,5 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
|
|
@ -9,16 +10,17 @@ jobs:
|
|||
build:
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
run_test: false
|
||||
run-test: false
|
||||
|
||||
release:
|
||||
name: Release
|
||||
name: Release on GitHub
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
|
@ -42,29 +44,24 @@ jobs:
|
|||
ls -l target/
|
||||
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: ${{ github.ref_name }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
target/tree-sitter-*.gz
|
||||
target/tree-sitter.wasm
|
||||
run: |-
|
||||
gh release create \
|
||||
target/tree-sitter-*.gz \
|
||||
target/tree-sitter.wasm \
|
||||
target/tree-sitter.js
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
crates_io:
|
||||
name: Publish CLI to Crates.io
|
||||
name: Publish packages to Crates.io
|
||||
runs-on: ubuntu-latest
|
||||
needs: release
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- name: Set up Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
|
||||
- name: Publish crates to Crates.io
|
||||
uses: katyo/publish-crates@v2
|
||||
|
|
@ -72,29 +69,32 @@ jobs:
|
|||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
|
||||
npm:
|
||||
name: Publish lib to npmjs.com
|
||||
name: Publish packages to npmjs.com
|
||||
runs-on: ubuntu-latest
|
||||
needs: release
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
directory: ["cli/npm", "lib/binding_web"]
|
||||
directory: [cli/npm, lib/binding_web]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: CHeckout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: https://registry.npmjs.org
|
||||
|
||||
- name: Set up Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
|
||||
- name: Build wasm
|
||||
if: matrix.directory == 'lib/binding_web'
|
||||
run: cargo xtask build-wasm
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Publish lib to npmjs.com
|
||||
- name: Publish to npmjs.com
|
||||
working-directory: ${{ matrix.directory }}
|
||||
run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
run: |
|
||||
cd ${{ matrix.directory }}
|
||||
npm publish
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue