Publish #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
workflow_dispatch: | |
env: | |
DEBUG: 'napi:*' | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Check formatting | |
run: cargo fmt --all --check | |
- name: Clippy | |
run: cargo clippy | |
build: | |
runs-on: ubuntu-latest | |
container: quay.io/pypa/manylinux_2_28_x86_64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: x86_64-pc-windows-msvc, x86_64-unknown-linux-gnu | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo install cargo-xwin | |
- name: Node install | |
run: npm ci | |
- name: Build Linux | |
run: npm run build -- --target x86_64-unknown-linux-gnu | |
- name: Build Windows | |
run: npm run build -- --target x86_64-pc-windows-msvc | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OS specific binaries | |
path: dist | |
if-no-files-found: error | |
build-mac: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: x86_64-apple-darwin, aarch64-apple-darwin | |
- uses: Swatinem/rust-cache@v2 | |
- name: Node install | |
run: npm ci | |
- name: Build Mac x64 | |
run: npm run build -- --target x86_64-apple-darwin | |
- name: Build Mac arm64 | |
run: npm run build -- --target aarch64-apple-darwin | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OS specific binaries | |
path: dist | |
if-no-files-found: error | |
deploy: | |
# prevents this action from running on forks or pull requests | |
if: ${{ github.repository == 'fishpondstudio/steamworks.js' && github.event_name == 'workflow_dispatch' }} | |
runs-on: ubuntu-latest | |
needs: [build, build-mac] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download build | |
uses: actions/download-artifact@v3 | |
with: | |
name: OS specific binaries | |
path: dist/ | |
- name: Log files | |
run: | | |
echo "- Root directory:" && ls | |
echo "- Dist directory:" && ls -R dist | |
- name: Publish to npm | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public |