minify-html/.github/workflows/java.yml

88 lines
2.7 KiB
YAML
Raw Normal View History

name: Build, package, and upload Java library
on:
create:
tags:
- 'v*'
jobs:
2020-01-18 02:20:00 -05:00
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
ARCH: linux-x86_64
2020-01-18 02:20:00 -05:00
FILE: 'libhyperbuild_java.so'
- os: windows-latest
ARCH: windows-x86_64
2020-01-18 02:20:00 -05:00
FILE: 'hyperbuild_java.dll'
- os: macos-latest
ARCH: macos-x86_64
2020-01-18 02:20:00 -05:00
FILE: 'libhyperbuild_java.dylib'
steps:
- uses: actions/checkout@v1
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build Java native library
run: cargo build --release
working-directory: ./java
- name: Upload built library
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.ARCH }}
2020-01-18 02:20:00 -05:00
path: ./java/target/rust/release/${{ matrix.FILE }}
package:
2020-01-18 01:02:02 -05:00
runs-on: ubuntu-latest
2020-01-18 02:20:00 -05:00
needs: build
steps:
- uses: actions/checkout@v1
- name: Get version
id: version
shell: bash
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
- name: Set up JDK
uses: actions/setup-java@v1
with:
2020-01-18 08:21:58 -05:00
java-version: '1.7'
java-package: jdk
architecture: x64
- name: Download Windows built library
uses: actions/download-artifact@v1
with:
name: windows-x86_64
path: java/src/main/resources/windows-x86_64
- name: Download Linux built library
uses: actions/download-artifact@v1
with:
name: linux-x86_64
path: java/src/main/resources/linux-x86_64
- name: Download macOS built library
uses: actions/download-artifact@v1
with:
name: macos-x86_64
path: java/src/main/resources/macos-x86_64
- name: Move native library files to correct location
shell: bash
working-directory: ./java/src/main/resources
run: |
for f in *; do
mv $f/* "$f.nativelib"
rmdir "$f"
done
- name: Build and package JAR
working-directory: ./java
2020-01-18 02:20:00 -05:00
run: mvn clean package
- uses: chrislennon/action-aws-cli@v1.1
- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
run: aws s3 cp ./java/target/hyperbuild-${{ steps.version.outputs.VERSION }}.jar s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/${{ steps.version.outputs.VERSION }}.jar