Skip to content

Commit

Permalink
ci: add publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Feb 10, 2024
1 parent a3fa754 commit f682b3a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 8 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,29 @@ on:
branches: [master]

jobs:
test:
node:
name: Test Node library
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Checkout repository
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
name: Set up NodeJS
with:
node-version: 16
- run: npm install
name: Install dependencies
- run: npm test
name: Run tests
node-version: 20
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
rust:
name: Test Rust library
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Run tests
run: cargo test
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish package

on:
push:
tags: ['*']

jobs:
node:
name: Publish Node package
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/tree-sitter-gitattributes
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install packages
run: npm install
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
rust:
name: Publish Rust package
runs-on: ubuntu-latest
environment:
name: crates
url: https://crates.io/crates/tree-sitter-gitattributes
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_TOKEN}}

0 comments on commit f682b3a

Please sign in to comment.