Skip to content

Release Perform v1.1.0 #57

Release Perform v1.1.0

Release Perform v1.1.0 #57

name: Release Perform
run-name: Release Perform v${{ github.event.inputs.releaseVersion }}
on:
workflow_dispatch:
inputs:
deploy:
type: boolean
required: true
default: true
releaseVersion:
type: string
required: true
jobs:
build-native:
strategy:
fail-fast: false
matrix:
config:
- host: ubuntu-latest
target: i686-unknown-linux-gnu
artifact: linux-x86_32
linker: gcc-multilib
pkgFlags: "--define 'skipTests'"
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: linux-x86_64
container: quay.io/pypa/manylinux_2_28_x86_64
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact: linux-aarch_64
linker: gcc-aarch64-linux-gnu
pkgFlags: "--define 'skipTests'"
- host: ubuntu-latest
target: armv7-linux-androideabi
artifact: linux-android-armv7
linker: gcc-arm-linux-gnueabihf
pkgFlags: "--define 'skipTests'"
- host: ubuntu-latest
target: aarch64-linux-android
artifact: linux-android-aarch_64
linker: gcc-aarch64-linux-gnu
pkgFlags: "--define 'skipTests'"
- host: windows-latest
target: i686-pc-windows-msvc
artifact: windows-x86_32
pkgFlags: "--define 'skipTests'"
- host: windows-latest
target: x86_64-pc-windows-msvc
artifact: windows-x86_64
- host: macos-13
target: x86_64-apple-darwin
artifact: osx-x86_64
- host: macos-latest
target: aarch64-apple-darwin
artifact: osx-aarch_64
runs-on: ${{ matrix.config.host }}
container: ${{ matrix.config.container }}
steps:
- uses: actions/checkout@v3
with:
ref: v${{ github.event.inputs.releaseVersion }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.config.target }}
- uses: ./.github/workflows/rust-cache
- name: Install Linker
if: matrix.config.linker
run: |
sudo apt update
sudo apt install ${{ matrix.config.linker }}
- name: Prepare aarch64 Linker
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: |
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "AR_aarch64_unknown_linux_gnu=llvm-ar-14" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Prepare Android Linker
if: contains(matrix.config.target, 'android')
run: |
ndk_root=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/
adjusted_target=$(echo "${{ matrix.config.target }}" | tr '-' '_')
adjusted_target_upper=$(echo "$adjusted_target" | tr '[:lower:]' '[:upper:]')
compiler=""
if [[ "$adjusted_target" == *"aarch64"* ]]; then
compiler="aarch64-linux-android21-clang"
else
compiler="armv7a-linux-androideabi19-clang"
fi
echo "CC_${adjusted_target}=${ndk_root}/${compiler}" >> $GITHUB_ENV
echo "AR_${adjusted_target}=${ndk_root}/llvm-ar" >> $GITHUB_ENV
echo "CARGO_TARGET_${adjusted_target_upper}_LINKER=${ndk_root}/${compiler}" >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
- name: Run mvn package for native
if: ${{ ! matrix.config.container }}
run: mvn --batch-mode --projects ngrok-java-native --also-make package --activate-profiles ci-native --define 'ngrok.native.classifier=${{ matrix.config.artifact }}' --define 'ngrok.native.target=${{ matrix.config.target }}' ${{ matrix.config.pkgFlags }}
env:
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
- name: Install maven (with container)
if: matrix.config.container
run: |
curl -sL https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz -o maven.tar.gz
echo "332088670d14fa9ff346e6858ca0acca304666596fec86eea89253bd496d3c90deae2be5091be199f48e09d46cec817c6419d5161fb4ee37871503f472765d00 maven.tar.gz" | sha512sum -c -
tar xvf maven.tar.gz
rm maven.tar.gz
echo "JAVA_11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
echo "JAVA_17_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
echo "./apache-maven-3.8.8/bin/" >> $GITHUB_PATH
- name: Run mvn package for native (with container)
if: matrix.config.container
run: mvn --global-toolchains toolchains.xml --batch-mode --projects ngrok-java-native --also-make package --activate-profiles ci-native --define 'ngrok.native.classifier=${{ matrix.config.artifact }}' --define 'ngrok.native.target=${{ matrix.config.target }}' ${{ matrix.config.pkgFlags }}
env:
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ngrok-java-native-${{ github.event.inputs.releaseVersion }}-${{ matrix.config.artifact }}
path: ngrok-java-native/target/ngrok-java-native-${{ github.event.inputs.releaseVersion }}-${{ matrix.config.artifact }}.jar
retention-days: 1
deploy-central:
if: ${{ github.event.inputs.deploy }}
runs-on: ubuntu-latest
needs:
- build-native
steps:
- uses: actions/checkout@v3
with:
ref: v${{ github.event.inputs.releaseVersion }}
- uses: actions/setup-java@v3
with:
java-version: |
17
11
distribution: "temurin"
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- uses: actions/download-artifact@v3
with:
path: ngrok-java-native/target/
- run: mv ngrok-java-native/target/*/* ngrok-java-native/target/
- name: Run mvn deploy
run: mvn --batch-mode deploy --activate-profiles ci-distro,central-distro --fail-at-end
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
deploy-github:
if: ${{ github.event.inputs.deploy }}
runs-on: ubuntu-latest
needs:
- build-native
steps:
- uses: actions/checkout@v3
with:
ref: v${{ github.event.inputs.releaseVersion }}
- uses: actions/setup-java@v3
with:
java-version: |
17
11
distribution: "temurin"
- uses: actions/download-artifact@v3
with:
path: ngrok-java-native/target/
- run: mv ngrok-java-native/target/*/* ngrok-java-native/target/
- name: Run mvn deploy
run: mvn --batch-mode deploy --activate-profiles ci-distro,github-distro --fail-at-end
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}