@instill-ai/toolkit: v0.98.3 #523
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Images | |
on: | |
workflow_call: | |
release: | |
types: [published] | |
jobs: | |
docker-hub: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Docker Buildx | |
# Only console released tag is starting with v, others are starting with @ | |
if: ${{ (github.ref == 'refs/heads/main') && startsWith(github.event.release.tag_name, 'v') }} | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
if: ${{ (github.ref == 'refs/heads/main') && startsWith(github.event.release.tag_name, 'v') }} | |
uses: docker/login-action@v1 | |
with: | |
username: dropletbot | |
password: ${{ secrets.botDockerHubPassword }} | |
- name: Build and push (latest) | |
if: ${{ (github.ref == 'refs/heads/main') && startsWith(github.event.release.tag_name, 'v') }} | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: instill/console:latest | |
cache-from: type=registry,ref=instill/console:buildcache | |
cache-to: type=registry,ref=instill/console:buildcache,mode=max | |
- name: Set Versions | |
if: github.event_name == 'release' && ${{ startsWith(github.event.release.tag_name, 'v') }} | |
uses: actions/github-script@v6 | |
id: set_version | |
with: | |
script: | | |
const tag = '${{ github.event.release.tag_name }}' | |
const no_v_tag = tag.replace('v', '') | |
core.setOutput('tag', tag) | |
core.setOutput('no_v_tag', no_v_tag) | |
- name: Checkout | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
uses: actions/checkout@v3 | |
- name: Setup node | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- uses: pnpm/[email protected] | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
id: pnpm-cache | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- uses: actions/cache@v3 | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
run: rm -rf node_modules && pnpm i --frozen-lockfile | |
- name: Set up Docker Buildx | |
# Only console released tag is starting with v, others are starting with @ | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
uses: docker/login-action@v1 | |
with: | |
username: dropletbot | |
password: ${{ secrets.botDockerHubPassword }} | |
- name: Build and push (release) | |
if: ${{ (github.event_name == 'release') && startsWith(github.event.release.tag_name, 'v') }} | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: instill/console:${{steps.set_version.outputs.no_v_tag}} | |
cache-from: type=registry,ref=instill/console:buildcache | |
cache-to: type=registry,ref=instill/console:buildcache,mode=max |