sealday
8141ef3d36
Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#780
59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
name: Build docker image
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
publish_npm_packages:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
registry-url: ${{ vars.REGISTRY_URL }}
|
|
cache: 'pnpm'
|
|
- name: Install deps
|
|
run: pnpm install
|
|
- name: Build
|
|
run: pnpm build:p
|
|
- name: Publish
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPMTOKEN }}
|
|
run: pnpm -r publish --access=public --no-git-checks --publish-branch ${{ gitea.ref }}
|
|
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
needs: publish_npm_packages
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.DOCKERHUB_URL }}
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
- name: Extract and format tag name
|
|
id: extract_tag
|
|
run: echo version=`echo "${{ gitea.ref }}" | cut -d'/' -f3 | sed 's/^v//'` >> "$GITHUB_OUTPUT"
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
build-args: |
|
|
TACHYBASE_VERSION=${{ steps.extract_tag.outputs.version }}
|
|
NPM_REGISTRY=${{ vars.REGISTRY_URL }}
|
|
tags: |
|
|
${{ vars.DOCKERHUB_URL }}/tachybase/tachybase:${{ steps.extract_tag.outputs.version }}
|
|
${{ vars.DOCKERHUB_URL }}/tachybase/tachybase:latest
|