mirror of
https://github.com/apache/maven-mvnd.git
synced 2026-01-14 07:03:54 +08:00
246 lines
8.8 KiB
YAML
246 lines
8.8 KiB
YAML
#
|
|
# Copyright (c) 2017 Angelo Zerr and other contributors as
|
|
# indicated by the @author tags.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
name: Release
|
|
|
|
on:
|
|
# manual trigger
|
|
workflow_dispatch:
|
|
# build on new tags
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
env:
|
|
GRAALVM_VERSION: '22.3.1'
|
|
JAVA_VERSION: '17'
|
|
|
|
jobs:
|
|
build:
|
|
name: 'Build with Graal on ${{ matrix.os }}'
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
os: [ ubuntu-18.04, macOS-10.15, windows-2019 ]
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: 'Check out repository'
|
|
uses: actions/checkout@v2
|
|
|
|
- name: 'Set vars'
|
|
shell: bash
|
|
run: |
|
|
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
|
|
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
|
|
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
|
|
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
|
|
|
- name: 'Set up Graal'
|
|
uses: graalvm/setup-graalvm@v1
|
|
with:
|
|
version: ${{ env.GRAALVM_VERSION }}
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
components: 'native-image'
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: 'Maven clean'
|
|
run: ./mvnw clean -Dmrm=false -B -ntp -e
|
|
|
|
- name: 'Patch Graal libs for only requiring glibc 2.12'
|
|
shell: bash
|
|
run: |
|
|
if [[ $OS == linux ]] && [[ $GRAALVM_HOME ]] && [[ -d "$GRAALVM_HOME/lib/static/linux-amd64/glibc" ]]; then
|
|
mkdir -p client/target/graalvm-libs-for-glibc-2.12
|
|
echo "memcpy memcpy@GLIBC_2.2.5" >client/target/glibc.redef
|
|
echo "posix_spawn posix_spawn@GLIBC_2.2.5" >>client/target/glibc.redef
|
|
find "$GRAALVM_HOME/lib/static/linux-amd64/glibc" -name '*.a' | while IFS= read -r input; do
|
|
output="client/target/graalvm-libs-for-glibc-2.12/$(basename -- "$input")"
|
|
objcopy --redefine-syms=client/target/glibc.redef -- "$input" "$output" 2>/dev/null
|
|
done
|
|
find /usr/lib -name libz.a | xargs -r -I {} objcopy --redefine-syms=client/target/glibc.redef {} client/target/graalvm-libs-for-glibc-2.12/libz.a
|
|
fi
|
|
|
|
- name: 'Build native distribution'
|
|
run: ./mvnw verify -Pnative -Dmrm=false -B -ntp -e -DskipTests -s .mvn/release-settings.xml
|
|
|
|
- name: 'Upload artifact'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: artifacts
|
|
path: |
|
|
dist/target/maven-mvnd-*.zip
|
|
dist/target/maven-mvnd-*.tar.gz
|
|
|
|
source:
|
|
name: 'Build source distributions'
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- name: 'Check out repository'
|
|
uses: actions/checkout@v2
|
|
|
|
- name: 'Set vars'
|
|
shell: bash
|
|
run: |
|
|
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
|
|
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
|
|
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
|
|
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
|
|
|
- name: 'Set up Graal'
|
|
uses: graalvm/setup-graalvm@v1
|
|
with:
|
|
version: ${{ env.GRAALVM_VERSION }}
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
components: 'native-image'
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: 'Build source distribution'
|
|
run: ./mvnw clean verify -Psource-distribution -N -B -ntp -e
|
|
|
|
- name: 'Upload artifact'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: artifacts
|
|
path: |
|
|
target/maven-mvnd-*.zip
|
|
target/maven-mvnd-*.tar.gz
|
|
|
|
release:
|
|
runs-on: ubuntu-18.04
|
|
needs: [build, source]
|
|
|
|
steps:
|
|
- name: 'Check out repository'
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: 'Download all build artifacts'
|
|
uses: actions/download-artifact@v2
|
|
|
|
- name: 'Set up Java'
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
distribution: 'zulu'
|
|
|
|
- name: 'Cache Maven packages'
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.m2
|
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ${{ runner.os }}-m2
|
|
|
|
- name: ls -R
|
|
run: ls -R
|
|
|
|
- name: Set environment
|
|
run: |
|
|
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ env.VERSION }}
|
|
release_name: ${{ env.VERSION }}
|
|
draft: true
|
|
prerelease: false
|
|
|
|
- name: Deploy maven-mvnd-src.zip
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: artifacts/maven-mvnd-${{ env.VERSION }}-src.zip
|
|
asset_name: maven-mvnd-${{ env.VERSION }}-src.zip
|
|
asset_content_type: application/zip
|
|
|
|
- name: Deploy maven-mvnd-src.tar.gz
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: artifacts/maven-mvnd-${{ env.VERSION }}-src.tar.gz
|
|
asset_name: maven-mvnd-${{ env.VERSION }}-src.tar.gz
|
|
asset_content_type: application/tar.gz
|
|
|
|
- name: Deploy maven-mvnd-linux-amd64.zip
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: artifacts/maven-mvnd-${{ env.VERSION }}-linux-amd64.zip
|
|
asset_name: maven-mvnd-${{ env.VERSION }}-linux-amd64.zip
|
|
asset_content_type: application/zip
|
|
|
|
- name: Deploy maven-mvnd-linux-amd64.tar.gz
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: artifacts/maven-mvnd-${{ env.VERSION }}-linux-amd64.tar.gz
|
|
asset_name: maven-mvnd-${{ env.VERSION }}-linux-amd64.tar.gz
|
|
asset_content_type: application/x-gzip
|
|
|
|
- name: Deploy maven-mvnd-darwin-amd64.zip
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: artifacts/maven-mvnd-${{ env.VERSION }}-darwin-amd64.zip
|
|
asset_name: maven-mvnd-${{ env.VERSION }}-darwin-amd64.zip
|
|
asset_content_type: application/zip
|
|
|
|
- name: Deploy maven-mvnd-darwin-amd64.tar.gz
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: artifacts/maven-mvnd-${{ env.VERSION }}-darwin-amd64.tar.gz
|
|
asset_name: maven-mvnd-${{ env.VERSION }}-darwin-amd64.tar.gz
|
|
asset_content_type: application/x-gzip
|
|
|
|
- name: Deploy maven-mvnd-windows-amd64.zip
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: artifacts/maven-mvnd-${{ env.VERSION }}-windows-amd64.zip
|
|
asset_name: maven-mvnd-${{ env.VERSION }}-windows-amd64.zip
|
|
asset_content_type: application/zip
|
|
|
|
- name: Deploy maven-mvnd-windows-amd64.tar.gz
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: artifacts/maven-mvnd-${{ env.VERSION }}-windows-amd64.tar.gz
|
|
asset_name: maven-mvnd-${{ env.VERSION }}-windows-amd64.tar.gz
|
|
asset_content_type: application/x-gzip
|