Skip to content

v0.6.2 🐋

v0.6.2 🐋 #145

Workflow file for this run

name: Release Docker Image and Pypi Package
on:
release:
types: [published]
jobs:
pypi-release:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v3
with:
python-version: "3.7"
architecture: "x64"
- name: Get pip cache
id: pip-cache-path
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip dependencies
uses: actions/cache@v3
id: pip-cache
with:
path: ${{ steps.pip-cache-path.outputs.dir }}
key: ${{ runner.os }}-codestyle-${{ hashFiles('client/requirements-dev.txt')}}
- name: Install dependencies
working-directory: ./client
run: |
make install-sw
make install-dev-req
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
- name: Build Python Package
working-directory: ./client
env:
PYPI_RELEASE_VERSION: ${{ steps.tag.outputs.tag }}
run: make build-wheel
- name: Publish a Python distribution to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
packages_dir: client/dist/
verify_metadata: false
server-image-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache-dependency-path: "./console/yarn.lock"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Install dev tools
working-directory: ./console
run: make install-dev-tools
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install project dependencies
working-directory: ./console
if: steps.yarn-cache.outputs.cache-hit != 'true' # Over here!
run: make install-dependencies
- name: Yarn Build
working-directory: ./console
run: make build-all
env:
NODE_OPTIONS: "--max-old-space-size=5120"
# jar build
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"
cache: "maven"
server-id: starwhale # Value of the distributionManagement/repository/id field of the pom.xml
- name: Build with Maven
working-directory: ./server
run: make build-package
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push docker image
working-directory: ./docker
env:
RELEASE_VERSION: ${{ steps.tag.outputs.tag }}
PYPI_RELEASE_VERSION: ${{ steps.tag.outputs.tag }}
run: |
make build-server
make build-dataset-builder
make build-runtime-dockerizing-builder
helm-charts-release:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
needs:
- server-image-release
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
- name: Package, Index and Publish
working-directory: ./docker/charts
env:
RELEASE_VERSION: ${{ steps.tag.outputs.tag }}
API_TOKEN_GITHUB: ${{ secrets.RELEASE_HELM_CHARTS_TOKEN }}
run: |
make cleanup
make package
make upload
pre-deploy:
runs-on: self-hosted
needs:
- helm-charts-release
steps:
- name: Helm Charts Upgrade
run: |
helm repo add starwhale https://star-whale.github.io/charts/
helm repo update
helm upgrade --devel --install starwhale starwhale/starwhale --namespace starwhale --create-namespace --version ${{ needs.helm-charts-release.outputs.tag }} --set image.registry=${{ secrets.PRIVATE_PRE_DOCKER_REGISTRY }}