2022-10-28 03:41:48 +00:00
|
|
|
name: Aliyun Container Registry
|
2022-10-25 01:43:22 +00:00
|
|
|
|
|
|
|
on:
|
2022-10-28 15:17:47 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'develop'
|
|
|
|
paths:
|
|
|
|
- 'packages/**'
|
2022-12-13 05:37:32 +00:00
|
|
|
- 'docker/nocobase/**'
|
|
|
|
- 'Dockerfile.acr'
|
|
|
|
- '.github/workflows/aliyun-container-registry.yml'
|
2022-10-28 03:41:48 +00:00
|
|
|
pull_request:
|
2022-10-25 01:43:22 +00:00
|
|
|
branches:
|
|
|
|
- '**'
|
2022-10-28 03:41:48 +00:00
|
|
|
paths:
|
|
|
|
- 'packages/**'
|
2022-12-13 05:37:32 +00:00
|
|
|
- 'docker/nocobase/**'
|
|
|
|
- 'Dockerfile.acr'
|
|
|
|
- '.github/workflows/aliyun-container-registry.yml'
|
2022-10-25 01:43:22 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
push-acr:
|
2022-12-13 05:37:32 +00:00
|
|
|
if: github.event.pull_request.head.repo.fork != true
|
2022-10-25 01:43:22 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
verdaccio:
|
|
|
|
image: verdaccio/verdaccio
|
|
|
|
ports:
|
|
|
|
- 4873:4873
|
|
|
|
steps:
|
2022-11-16 04:53:58 +00:00
|
|
|
- name: Checkout
|
2022-10-25 01:43:22 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-11-29 03:31:30 +00:00
|
|
|
with:
|
|
|
|
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }}
|
|
|
|
submodules: true
|
2022-11-16 04:53:58 +00:00
|
|
|
- name: Set up QEMU
|
2022-10-25 01:43:22 +00:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2022-11-16 04:53:58 +00:00
|
|
|
- name: Set up Docker Buildx
|
2022-10-25 01:43:22 +00:00
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
with:
|
|
|
|
driver-opts: network=host
|
2022-11-16 04:53:58 +00:00
|
|
|
- name: Docker meta
|
2022-10-25 01:43:22 +00:00
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
nocobase/nocobase
|
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
2022-11-16 04:53:58 +00:00
|
|
|
- name: Login to Docker Hub
|
2022-10-25 01:43:22 +00:00
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ${{ secrets.ALI_DOCKER_REGISTRY }}
|
|
|
|
username: ${{ secrets.ALI_DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.ALI_DOCKER_PASSWORD }}
|
2022-11-16 04:53:58 +00:00
|
|
|
- name: Build and push
|
2022-10-25 01:43:22 +00:00
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
context: .
|
2022-11-29 03:31:30 +00:00
|
|
|
file: Dockerfile.acr
|
2022-11-16 04:53:58 +00:00
|
|
|
build-args: |
|
2022-10-25 01:43:22 +00:00
|
|
|
VERDACCIO_URL=http://localhost:4873/
|
2022-11-16 04:53:58 +00:00
|
|
|
COMMIT_HASH=${GITHUB_SHA}
|
2022-10-25 01:43:22 +00:00
|
|
|
push: true
|
|
|
|
tags: ${{ secrets.ALI_DOCKER_REGISTRY }}/${{ steps.meta.outputs.tags }}
|
2022-12-13 02:42:18 +00:00
|
|
|
- name: Deploy NocoBase
|
2022-11-30 08:10:12 +00:00
|
|
|
env:
|
|
|
|
IMAGE_TAG: ${{ steps.meta.outputs.tags }}
|
|
|
|
run: |
|
2022-12-13 02:42:18 +00:00
|
|
|
echo $IMAGE_TAG
|
|
|
|
export APP_NAME=$(echo $IMAGE_TAG | cut -d ":" -f 2)
|
|
|
|
echo $APP_NAME
|
|
|
|
curl --location --request POST "${{secrets.NOCOBASE_DEPLOY_HOST}}$APP_NAME" \
|
|
|
|
--header 'Content-Type: application/json' \
|
|
|
|
-d "{
|
|
|
|
\"tag\": \"$APP_NAME\",
|
|
|
|
\"dialect\": \"postgres\"
|
|
|
|
}"
|