Native Image Linux Build #27
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: Native Image Linux Build | |
on: | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
name: fallout76-assistant on ${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
arch: linux-amd64 | |
steps: | |
- name: 拉取项目 | |
uses: actions/checkout@v3 | |
- name: 配置环境 | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '21' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
native-image-job-reports: 'true' | |
cache: maven | |
- name: 构建 Native Image | |
run: | | |
cd /home/runner/work/fallout76-public/fallout76-public | |
mvn clean install -U -Dmaven.test.skip=true | |
cd base-service-provider | |
mvn native:compile -Pnative -Dmaven.test.skip=true | |
- name: 打包 | |
run: | | |
cd /home/runner/work/fallout76-public/fallout76-public/base-service-provider | |
mkdir -p fallout76-assistant/config | |
mkdir -p fallout76-assistant/lib | |
cd fallout76-assistant | |
cp ../src/main/resources/application.yml config/ | |
cp ../target/fallout76-assistant-robot ./ | |
cp ../target/*.so lib/ | |
echo '#!/bin/bash' > run.sh | |
echo './fallout76-assistant-robot -Xmx512m -XX:+PrintGC -XX:+PrintGCTimes -XX:+VerboseGC -Djava.home=. -Djavax.xml.accessExternalDTD=all' >> run.sh | |
chmod +x run.sh | |
tar -zcvf fallout76-assistant.tar.gz ./* | |
- name: 获取当前 Tag | |
id: get_tag | |
shell: bash | |
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: 上传 Native Image | |
uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_name: fallout76-assistant-${{ steps.get_tag.outputs.tag }}-linux-amd64.tar.gz | |
asset_path: /home/runner/work/fallout76-public/fallout76-public/base-service-provider/fallout76-assistant/*.tar.gz | |
asset_content_type: application/x-compressed-tar | |
- name: 登录 Docker | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: 构建并推送 Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: /home/runner/work/fallout76-public/fallout76-public/base-service-provider/fallout76-assistant | |
file: /home/runner/work/fallout76-public/fallout76-public/docker/Dockerfile | |
push: true | |
tags: | | |
wssy001/fallout76-public | |
wssy001/fallout76-public:${{ steps.get_tag.outputs.tag }} | |
wssy001/fallout76-public:amd64 |