tachybase_todo/.gitea/workflows/build-docker.yaml

51 lines
1.6 KiB
YAML
Raw Permalink Normal View History

name: build release image
on:
push:
tags:
- 'release-*'
env:
npm_config_registry: ${{ vars.REGISTRY_URL }}
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.16.0
registry-url: ${{ vars.REGISTRY_URL }}
cache: 'pnpm'
- 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` >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: docker/tachybase/Dockerfile
push: true
# not work now https://github.com/go-gitea/gitea/pull/29584 wait for gitea 1.23.0
# cache-from: type=gha
# cache-to: type=gha,mode=max
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