Skip to content

Tag Realse

Tag Realse #13

Workflow file for this run

name: Tag Realse
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build whole project and release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up variables
id: variables
run: |
tag="$(basename $GITHUB_REF)"
bkjobVersion=${tag##v}
echo "::set-output name=tag::${tag}"
echo "::set-output name=bkjobVersion::${bkjobVersion}"
- name: init mysql
run: |
sudo /etc/init.d/mysql start
export MYSQL_PWD=root
for i in */*.sql;do echo $i;mysql -h localhost -uroot < $i;done
working-directory: support-files/sql
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Gradle
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle Build Backend
working-directory: src/backend
run: ./gradlew clean build -DbkjobVersion=${{ steps.variables.outputs.bkjobVersion }} -DmysqlURL=127.0.0.1:3306 -DmysqlUser=root -DmysqlPasswd=root -DmavenRepoUrl="https://maven.aliyun.com/nexus/content/groups/public/"
- name: Npm Build Frontend
run: |
echo "npm version=$(npm -v)"
export JOB_VERSION=${{ steps.variables.outputs.bkjobVersion }}
npm i --legacy-peer-deps && npm run build
mkdir -p release/job/frontend
cp -r dist/* release/job/frontend
working-directory: src/frontend
- name: Build VersionLogs
run: python genBundledVersionLog.py
working-directory: versionLogs
- name: Create artifact - make package
id: create_artifact
run: |
echo ${{ steps.variables.outputs.bkjobVersion }} > ./VERSION
chmod 755 ./package.sh
./package.sh -m all -v ${{ steps.variables.outputs.bkjobVersion }}
working-directory: ./
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: bk-job ${{ github.ref }}
draft: true
prerelease: true
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release/job_ce-${{ steps.variables.outputs.bkjobVersion }}.tgz
asset_name: job_ce-${{ steps.variables.outputs.bkjobVersion }}.tgz
asset_content_type: application/gzip