fix(typo): change Simple
to Import
to match the example in mind (#7)
#4
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 | |
on: | |
push: | |
tags: | |
- '**' | |
jobs: | |
create_pre_release: | |
name: Create pre-release | |
runs-on: ubuntu-latest | |
steps: | |
# The pre-release must be created only once, hence the split | |
# into multiple jobs with different `strategy`. | |
- name: Create a Github pre-release | |
id: create_pre_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: false | |
prerelease: true | |
- name: Output `release_url` into a temporary file | |
run: echo "${{ steps.create_pre_release.outputs.upload_url }}" > release_url.txt | |
- name: Save the `release_url` temporary file | |
uses: actions/upload-artifact@v1 | |
with: | |
name: release_url | |
path: release_url.txt | |
publish_jar: | |
name: Publish the JARs | |
needs: [create_pre_release] | |
strategy: | |
matrix: | |
# The job runs on 3 different OS. | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# The job runs on different Java versions (LTS). | |
java: [8] | |
# As soon as one job fails in the matrix, all the other | |
# in-progress jobs are canceled. | |
fail-fast: true | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Java ${{ matrix.version }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
override: true | |
- name: Cache Cargo registry | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache Cargo bin | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/bin | |
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache Cargo build | |
uses: actions/cache@v1 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run all the tests | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
make test | |
- name: Create the JAR | |
id: create_jar | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
make package | |
- name: Load the `release_url` from the temporary file | |
uses: actions/download-artifact@v1 | |
with: | |
name: release_url | |
- name: Read the `release_url` temporary file | |
id: get_release_info | |
shell: bash | |
run: | | |
value=$(cat release_url/release_url.txt) | |
echo ::set-output name=upload_url::$value | |
- name: Upload JAR as Github pre-release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
asset_path: ${{ steps.create_jar.outputs.path }} | |
asset_name: ${{ steps.create_jar.outputs.name }} | |
asset_content_type: application/java-archive | |
- name: Upload JAR to Bintray (JCenter) | |
env: | |
BINTRAY_USER: ${{ secrets.BINTRAY_USER }} | |
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }} | |
shell: bash | |
run: | | |
export PATH="$HOME/.cargo/bin:$PATH" | |
make publish |