Merge pull request #3 from breadrock1/fix/fix-native-lib-including #23
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: "Create release" | |
on: | |
push: | |
branches: | |
- "master" | |
- "release/**" | |
jobs: | |
create-release: | |
name: create release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
version_output: ${{ steps.version.outputs.project_version }} | |
upload_url_output: ${{ steps.release.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
architecture: x64 | |
- name: Get project version | |
id: version | |
run: | | |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo "project_version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create github release | |
id: release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: false | |
prerelease: false | |
body_path: CHANGELOG.md | |
tag_name: adblock-coffee-${{ steps.version.outputs.project_version }} | |
release_name: adblock-coffee-${{ steps.version.outputs.project_version }} | |
build: | |
name: build project | |
runs-on: ubuntu-latest | |
needs: create-release | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
rust-target: [ | |
'x86_64-unknown-linux-gnu', | |
# 'aarch64-linux-android', | |
# 'armv7-linux-androideabi', | |
# 'i686-linux-android' | |
] | |
outputs: | |
java_platform: ${{ steps.jdk.outputs.java_platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: ${{ matrix.rust-target }} | |
- name: Select jdk platform | |
id: jdk | |
run: | | |
if [ ${{ matrix.rust-target }} == 'aarch64-linux-android' ]; then | |
echo "java_platform=aarch64" >> $GITHUB_OUTPUT | |
elif [ ${{ matrix.rust-target }} == 'armv7-linux-androideabi' ]; then | |
echo "java_platform=armv7" >> $GITHUB_OUTPUT | |
elif [ ${{ matrix.rust-target }} == 'i686-linux-android' ]; then | |
echo "java_platform=x86" >> $GITHUB_OUTPUT | |
else | |
echo "java_platform=x64" >> $GITHUB_OUTPUT | |
fi | |
- name: Build rust library for ${{ matrix.rust-target }} | |
run: | | |
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android | |
cargo build --release --manifest-path adblock-rs/Cargo.toml | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
architecture: ${{ steps.jdk.outputs.java_platform }} | |
- name: Build java library | |
run: mvn package | |
- name: Create archive | |
uses: vimtor/action-zip@5f1c4aa587ea41db1110df6a99981dbe19cee310 | |
with: | |
files: ./target | |
dest: adblock-coffee-${{ matrix.rust-target }}-${{ needs.create-release.outputs.version_output }}.zip | |
recursive: true | |
- name: Upload linux artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url_output }} | |
asset_name: adblock-coffee-${{ matrix.rust-target }}-${{ needs.create-release.outputs.version_output }}.zip | |
asset_path: ./adblock-coffee-${{ matrix.rust-target }}-${{ needs.create-release.outputs.version_output }}.zip | |
asset_content_type: application/zip |