Skip to content

update publish script #3

update publish script

update publish script #3

Workflow file for this run

name: Build and Publish
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Install cross
run: cargo install cross
- name: Run tests
run: cargo test --verbose --workspace
- name: Build for all targets
run: |
mkdir -p dist builds
for target in x86_64-pc-windows-gnu i686-pc-windows-gnu x86_64-unknown-linux-gnu x86_64-apple-darwin; do
cross build --release --target $target --workspace
mkdir -p builds/surreal-codegen-$target
if [[ $target == *"windows"* ]]; then
cp target/$target/release/*.exe builds/surreal-codegen-$target/
else
cp target/$target/release/* builds/surreal-codegen-$target/
fi
tar -C builds -czvf dist/surreal-codegen-$target.tar.gz surreal-codegen-$target
done
- name: Upload release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: dist/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish npm package
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd surreal-codegen
npm publish --access public