Fix CI, upgrade actions/* version. (#220) #47
Workflow file for this run
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: Release Java | |
on: | |
push: | |
branches: | |
- "release-java" | |
tags: | |
- "v*" | |
jobs: | |
build: | |
strategy: | |
fail-fast: true | |
matrix: | |
settings: | |
- host: ubuntu-latest | |
lib_prefix: "lib" | |
lib_suffix: ".so" | |
target: x86_64-unknown-linux-gnu | |
- host: windows-latest | |
lib_suffix: ".dll" | |
target: x86_64-pc-windows-msvc | |
- host: macos-latest | |
lib_prefix: "lib" | |
lib_suffix: ".dylib" | |
target: x86_64-apple-darwin | |
- host: macos-latest | |
lib_prefix: "lib" | |
lib_suffix: ".dylib" | |
target: aarch64-apple-darwin | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
override: true | |
toolchain: stable | |
target: ${{ matrix.settings.target }} | |
- name: Build | |
run: | | |
cargo build -p autocorrect-java --release --target ${{ matrix.settings.target }} | |
mv target/${{ matrix.settings.target }}/release/${{ matrix.settings.lib_prefix }}autocorrect_java${{ matrix.settings.lib_suffix }} autocorrect_java-${{ matrix.settings.target }}${{ matrix.settings.lib_suffix }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jnis | |
path: autocorrect_java-${{ matrix.settings.target }}${{ matrix.settings.lib_suffix }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "11" | |
distribution: "temurin" | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: jnis | |
path: ./autocorrect-java/jnis | |
- name: Copy Jnis | |
working-directory: autocorrect-java | |
run: | | |
mkdir -p javasrc/target/natives/linux_64 | |
mkdir -p javasrc/target/natives/windows_64 | |
mkdir -p javasrc/target/natives/osx_64 | |
mkdir -p javasrc/target/natives/osx_arm64 | |
mv jnis/autocorrect_java-x86_64-unknown-linux-gnu.so javasrc/target/natives/linux_64/libautocorrect_java.so | |
mv jnis/autocorrect_java-x86_64-pc-windows-msvc.dll javasrc/target/natives/windows_64/autocorrect_java.dll | |
mv jnis/autocorrect_java-x86_64-apple-darwin.dylib javasrc/target/natives/osx_64/libautocorrect_java.dylib | |
mv jnis/autocorrect_java-aarch64-apple-darwin.dylib javasrc/target/natives/osx_arm64/libautocorrect_java.dylib | |
- name: Get version | |
working-directory: autocorrect-java | |
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV | |
- name: Update version | |
working-directory: autocorrect-java/javasrc | |
run: mvn versions:set -DnewVersion=${PACKAGE_VERSION} | |
- name: Publish maven package | |
uses: samuelmeuli/action-maven-publish@v1 | |
with: | |
maven_profiles: release | |
maven_goals_phases: deploy | |
directory: autocorrect-java/javasrc | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
nexus_username: ${{ secrets.OSSRH_USERNAME }} | |
nexus_password: ${{ secrets.OSSRH_PASSWORD }} |