Skip to content

Tag Release

Tag Release #19

Workflow file for this run

name: Tag Release
on:
push:
tags:
- 'v*'
jobs:
frontend:
name: Build frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install && yarn start && yarn public
working-directory: src/frontend
- uses: actions/upload-artifact@v1
with:
name: frontend
path: src/frontend/frontend/
agent:
name: Build agent on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
fail-fast: true
max-parallel: 3
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.18.1
- uses: actions/checkout@v2
- run: make clean build_linux
working-directory: src/agent/
if: matrix.os == 'ubuntu-latest'
- run: make clean build_macos
working-directory: src/agent/
if: matrix.os == 'macos-latest'
- run: build_windows.bat
shell: cmd
working-directory: src/agent/
if: matrix.os == 'windows-latest'
- uses: actions/upload-artifact@v1
with:
name: agent
path: src/agent/bin/
backend:
name: Build backend and release
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10
steps:
- uses: actions/checkout@v2
- name: init mysql
run: |
export MYSQL_PWD=root
for i in *.sql;do echo $i;mysql -h 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -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 Service
working-directory: src/backend/ci
run: |
./gradlew clean test build :core:worker:worker-agent:shadowJar \
-DmavenRepoUrl="https://maven.aliyun.com/nexus/content/groups/public/" \
-DmysqlURL=127.0.0.1:${{ job.services.mysql.ports['3306'] }} -DmysqlUser=root -DmysqlPasswd=root
- name: Gradle Build Turbo Service
working-directory: src/backend/turbo
run: |
./gradlew clean copyToRelease -DmavenRepoUrl="https://maven.aliyun.com/nexus/content/groups/public/"
# copy jar to ci release dir
cp -vf release/boot-turbo.jar ${{ github.workspace }}/src/backend/ci/release/
# copy turbo service config template to ci templates dir
cp -vrf support-files/templates/* ${{ github.workspace }}/support-files/templates/
- name: Create artifact - Step1:init
run: |
true # 暂无init需求, 保留此步骤.
- name: Create artifact - Step2:get Agent
uses: actions/download-artifact@v1
with:
name: agent
path: src/agent/bin/
- name: Create artifact - Step3:get Frontend
uses: actions/download-artifact@v1
with:
name: frontend
path: src/frontend/frontend
- name: Create artifact - Step4:make package
id: create-artifact
run: |
version="$(basename $GITHUB_REF)"
echo "::set-output name=version::$version"
ci_ms_wip="sign,monitoring" ci_pkg_dir=/dev/shm/ci ./scripts/packager-ci.sh "$version" bkci-slim.tar.gz
- 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-ci ${{ 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: ./bkci-slim.tar.gz
asset_name: bkci-slim.tar.gz
asset_content_type: application/gzip
- name: download codecc
uses: actions/download-artifact@v1
with:
name: codecc
path: ./
- 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: ./bkcodecc-slim.tar.gz
asset_name: bkcodecc-slim.tar.gz
asset_content_type: application/gzip
codecc:
name: Build CodeCC
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: CodeCC Cache Gradle
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-codecc-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-codecc-gradle-
- name: Gradle Build
id: codecc-backend
working-directory: src/backend/codecc
run: |
chmod +x gradlew
./gradlew clean copyToRelease -DmavenRepoUrl="https://maven.aliyun.com/nexus/content/groups/public/"
- name: frontend
id: codecc-frontend
run: |
cd src/frontend/devops-codecc
rm -rf dist
npm i
npm run build
if [ -f dist/index.html ]; then
mv dist/index.html dist/frontend#index.html
fi
- name: Create artifact - make package
id: create-artifact
run: |
version="$(basename $GITHUB_REF)"
echo "::set-output name=version::$version"
codecc_pkg_dir=/dev/shm/codecc ./scripts/deploy-codecc/packager-codecc.sh "$version" bkcodecc-slim.tar.gz "$PWD"
- uses: actions/upload-artifact@v1
with:
name: codecc
path: bkcodecc-slim.tar.gz