Skip to content

Merge pull request #284 from JiazhenBao/main #183

Merge pull request #284 from JiazhenBao/main

Merge pull request #284 from JiazhenBao/main #183

Workflow file for this run

# 为了试验,此处作为单独的 Workflow,在实际工作中可 Install -> Lint、Test -> Preview 串行检验
name: Release
# 执行 CI 的时机: 当 git push 到 main分支时
on:
push:
branches: main
permissions:
pull-requests: write
issues: write
contents: write
jobs:
build:
# 仅在pr关闭后执行
if: startsWith(github.event.head_commit.message, 'Merge pull request ')
runs-on: ubuntu-latest
steps:
- name: Check if commit is from CI
run: |
if [[ "${{ github.event.head_commit.committer.username }}" == "github-actions[bot]" ]]; then
echo "Commit is from CI, skipping the build..."
exit 78
else
echo "Commit is not from CI, continuing with the build..."
fi
- name: see vars
run: |
echo '${{github.head_ref}}'
echo '${{github.ref}}'
echo '${{github.ref_name}}'
echo '${{github.repository}}'
echo '${{ github.run_id }}'
echo '${{github.event.sender.id}}'
echo '${{github.event.repository.fork}}'
echo '${{github.event.repository.name}}'
echo '${{github.event.repository.full_name}}'
echo '${{github.actor}}'
echo '${{github.triggering_actor}}'
- name: Checkout
uses: actions/checkout/@v3
with:
fetch-depth: 1
token: ${{secrets.RELEASE_TOKEN}}
- name: Git Identity
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
git fetch --unshallow
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN}}
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: 16
- name: Install Dep
run: |
npm install
- name: Detect Pull Request Change
run: |
git config --global core.quotepath false
git config --global gui.encoding utf-8
git config --global i18n.commit.encoding utf-8
git config --global i18n.logoutputencoding utf-8
export LESSCHARSET=utf-8
npm run detectPR from-release
{
echo "DIFF_STATE<<EOF"
echo "$(cat diff_stat.json)"
echo "EOF"
} >> "$GITHUB_ENV"
- name: Set up JDK 8
if: ${{fromJson(env.DIFF_STATE).needJAVA}}
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
- name: Install JDK Dependency
if: ${{fromJson(env.DIFF_STATE).needJAVA}}
run: |
mvn install:install-file -Dfile="demo_bjz_JiazhenBao/jar/nasl-metadata-maven-plugin-1.3.0/nasl-metadata-maven-plugin-1.3.0.jar" -DpomFile="demo_bjz_JiazhenBao/jar/nasl-metadata-maven-plugin-1.3.0/pom.xml"
mvn install:install-file -Dfile="demo_bjz_JiazhenBao/jar/nasl-metadata-maven-plugin-1.4.1/nasl-metadata-maven-plugin-1.4.1.jar" -DpomFile="demo_bjz_JiazhenBao/jar/nasl-metadata-maven-plugin-1.4.1/pom.xml"
mvn install:install-file -Dfile="demo_bjz_JiazhenBao/jar/nasl-metadata-maven-plugin-1.4.0/nasl-metadata-maven-plugin-1.4.0.jar" -DpomFile="demo_bjz_JiazhenBao/jar/nasl-metadata-maven-plugin-1.4.0/pom.xml"
mvn install:install-file -DgroupId=com.netease.lowcode -DartifactId=nasl-metadata-collector -Dversion=0.8.0 -Dpackaging=jar -Dfile="demo_bjz_JiazhenBao/jar/nasl-metadata-collector-0.8.0.jar"
- name: Install LCAP
run: |
npm install -g [email protected]
lcap config set platform https://defaulttenant.lcap.hadri.163yun.com
lcap config set username admin
lcap config set password Admin@123456
- name: Check Pull Request
run: |
npm run release from-release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN}}
HEAD_BRANCH_NAME: ${{github.head_ref}}
GITHUB_REPOSITORY: ${{github.repository}}
ACTION_ID: ${{github.run_id}}
AMC_URL: ${{secrets.AMC_URL}}
AMC_BODY: ${{secrets.AMC_BODY}}
AMU_URL: ${{secrets.AMU_URL}}