Skip to content

Yatai - v1.1.9

Yatai - v1.1.9 #119

Workflow file for this run

name: Release
on:
push:
tags: [ v\d+\.\d+\.\d+\-d\d+ ]
release:
types: [ published ]
jobs:
build-dashboard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set vars
id: vars
run: |
echo "::set-output name=dashboard_hash::${{ hashFiles('./dashboard/**') }}"
- uses: tuler/s3-check-action@master
id: check-s3
env:
FILE: dashboard/${{ steps.vars.outputs.dashboard_hash }}/index.html
AWS_REGION: ap-northeast-1
AWS_S3_BUCKET: yatai-github-artifacts
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- uses: actions/setup-node@v3
with:
node-version: 16
if: steps.check-s3.outputs.exists == 'false'
- uses: actions/cache@v2
with:
path: '**/dashboard/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/dashboard/yarn.lock') }}
if: steps.check-s3.outputs.exists == 'false'
- name: Install packages
run: cd dashboard; yarn
if: steps.check-s3.outputs.exists == 'false'
- name: Build dashboard
run: cd dashboard; NODE_OPTIONS="--max_old_space_size=4096" yarn build
if: steps.check-s3.outputs.exists == 'false'
env:
CI: false
- name: Upload dashboard artifacts
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ap-northeast-1
source: './dashboard/build/'
dest: 's3://yatai-github-artifacts/dashboard/${{ steps.vars.outputs.dashboard_hash }}'
flags: --recursive
if: steps.check-s3.outputs.exists == 'false'
build-api-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set vars
id: vars
run: |
echo "::set-output name=api_server_hash::${{ hashFiles('./api-server/**', './common/**', '**/go.sum', '**go.mod') }}"
- uses: tuler/s3-check-action@master
id: check-s3
env:
FILE: api-server/${{ steps.vars.outputs.api_server_hash }}/api-server
AWS_REGION: ap-northeast-1
AWS_S3_BUCKET: yatai-github-artifacts
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Buildx Cache
uses: actions/cache@v3
with:
path: /tmp/buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/go.sum') }}
if: steps.check-s3.outputs.exists == 'false'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
if: steps.check-s3.outputs.exists == 'false'
- name: Build api-server
run: make docker-build-api-server
if: steps.check-s3.outputs.exists == 'false'
- name: Move cache
run: |
rm -rf /tmp/buildx-cache
mv /tmp/buildx-cache-new /tmp/buildx-cache
if: steps.check-s3.outputs.exists == 'false'
- name: Upload api-server artifacts
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ap-northeast-1
source: './bin/'
dest: 's3://yatai-github-artifacts/api-server/${{ steps.vars.outputs.api_server_hash }}'
flags: --recursive
if: steps.check-s3.outputs.exists == 'false'
release-image:
runs-on: ubuntu-latest
needs:
- build-dashboard
- build-api-server
steps:
- uses: actions/checkout@v3
- name: Set vars
id: vars
run: |
echo "::set-output name=dashboard_hash::${{ hashFiles('./dashboard/**') }}"
echo "::set-output name=api_server_hash::${{ hashFiles('./api-server/**', './common/**', '**/go.sum', '**go.mod') }}"
- name: Download dashboard artifacts
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ap-northeast-1
dest: './dashboard/build/'
source: 's3://yatai-github-artifacts/dashboard/${{ steps.vars.outputs.dashboard_hash }}'
flags: --recursive
- name: Download api-server artifacts
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ap-northeast-1
dest: './bin/'
source: 's3://yatai-github-artifacts/api-server/${{ steps.vars.outputs.api_server_hash }}'
flags: --recursive
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Build yatai image
run: make build-image
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
- name: Tag Yatai image as release
env:
VERSION: ${{ steps.tag.outputs.tag }}
run: make tag-release
release-helm-charts:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
needs:
- release-image
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: Check tag
id: check-tag
run: |
if [[ "${{ github.event.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+\-d[0-9]+$ ]]; then
echo ::set-output name=match::true
fi
- name: Package, Index and Publish to public repo
working-directory: ./helm/yatai
if: steps.check-tag.outputs.match != 'true'
env:
VERSION: ${{ steps.tag.outputs.tag }}
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
run: make release
- name: Package, Index and Publish to devel repo
working-directory: ./helm/yatai
if: steps.check-tag.outputs.match == 'true'
env:
VERSION: ${{ steps.tag.outputs.tag }}
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
run: make release-devel
concurrency:
group: yatai-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true