Skip to content

Commit

Permalink
Update workflow to publish crate, NPM package, and create GitHub release
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikvanantwerpen committed Oct 5, 2023
1 parent 83044af commit 59d2255
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 33 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish

on:
push:
tags:
- v*

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0

jobs:
publish-crate:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Verify crate
run: cargo publish --dry-run

- name: Publish crate
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish-npm:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"

- name: Verify package
run: npm publish --dry-run

- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish

create-release:

runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Create GitHub release
uses: ncipollo/release-action@v1
with:
body: |
Find tree-sitter-java ${{ github.ref_name }} on [crates.io](https://crates.io/crates/tree-sitter-java) or [NPM](https://www.npmjs.com/package/tree-sitter-java).
token: ${{ secrets.GITHUB_TOKEN }}
33 changes: 0 additions & 33 deletions .github/workflows/publish_crate.yml

This file was deleted.

0 comments on commit 59d2255

Please sign in to comment.