Install rustup before toolchain #47
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-natives | |
on: | |
push: | |
branches: [ "master" ] | |
paths: | |
- '.github/workflows/publish.yml' # when new targets are added | |
- 'build.gradle.kts' # when the root build script changes | |
- 'api' # when api source is changed | |
- 'native' # when natives are changed | |
concurrency: | |
group: "pub" | |
cancel-in-progress: true | |
jobs: | |
linux: | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
- target: i686-unknown-linux-gnu | |
deps: apt-get install -y gcc-multilib | |
- target: aarch64-unknown-linux-gnu | |
deps: apt-get install -y gcc-aarch64-linux-gnu | |
- target: armv7-unknown-linux-gnueabihf | |
deps: apt-get install -y gcc-arm-linux-gnueabihf | |
name: Publish ${{ matrix.target }} | |
environment: MavenRelease | |
runs-on: ubuntu-20.04 | |
container: | |
image: ubuntu:16.04 | |
steps: | |
- name: Checkout sources | |
uses: taiki-e/checkout-action@v1 | |
- name: Install Essentials | |
run: | | |
apt-get update -y | |
apt-get upgrade -y | |
apt-get install -y curl gcc openjdk-8-jdk-headless | |
curl --proto '=https' --tlsv1.2 --retry 10 --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y | |
echo "$CARGO_HOME/bin" >> $GITHUB_PATH | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: ${{ matrix.target }} | |
- name: Install linker dependencies | |
run: ${{ matrix.deps }} | |
if: ${{ matrix.deps != '' }} | |
- name: Compile natives | |
working-directory: native | |
run: cargo build -r --target=${{ matrix.target }} | |
- name: Publish | |
env: | |
ORG_GRADLE_PROJECT_ossrhUser: ${{ secrets.OSSRH_USER }} | |
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} | |
ORG_GRADLE_PROJECT_stagingProfile: ${{ secrets.STAGING_PROFILE_ID }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }} | |
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEYID }} | |
run: | | |
chmod u+x gradlew | |
./gradlew --console plain --stacktrace -Ptarget="${{ matrix.target }}" native:publishToSonatype closeAndReleaseStagingRepository | |
windows: | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-pc-windows-msvc | |
- target: i686-pc-windows-msvc | |
name: Publish ${{ matrix.target }} | |
environment: MavenRelease | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: ${{ matrix.target }} | |
- name: Compile natives | |
working-directory: native | |
run: cargo build -r --target=${{ matrix.target }} | |
- name: Publish | |
env: | |
ORG_GRADLE_PROJECT_ossrhUser: ${{ secrets.OSSRH_USER }} | |
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} | |
ORG_GRADLE_PROJECT_stagingProfile: ${{ secrets.STAGING_PROFILE_ID }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }} | |
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEYID }} | |
run: | | |
chmod u+x gradlew | |
./gradlew --console plain --stacktrace -Ptarget="${{ matrix.target }}" native:publishToSonatype closeAndReleaseStagingRepository |