forked from bytebase/bytebase
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (61 loc) · 2.15 KB
/
build-push-ci-image.yml
File metadata and controls
64 lines (61 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Build and push CI image
on:
# push:
# branches:
# - main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel.
jobs:
docker:
runs-on: [self-hosted, golangci]
steps:
- uses: actions/checkout@v3
- name: Extract build args
run: |
echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
echo "BUILD_USER=$(id -u -n)" >> $GITHUB_ENV
- uses: pnpm/action-setup@v2.2.4
with:
version: 8.6.0
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: pnpm
cache-dependency-path: "frontend/pnpm-lock.yaml"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: pnpm install --frozen-lockfile
working-directory: frontend
- name: Run pnpm release build
run: |
cp backend/plugin/advisor/config/* frontend/src/types
cp backend/enterprise/api/plan.yaml frontend/src/types
pnpm --dir ./frontend i && pnpm --dir ./frontend release
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
file: scripts/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: bytebase/bytebase:release-ci
build-args: |
RELEASE=release
VERSION_SUFFIX=-release-ci
GIT_COMMIT=${{ env.GITHUB_SHA }}
BUILD_TIME=${{ env.BUILD_TIME }}
BUILD_USER=${{ env.BUILD_USER }}
- name: Image digest
run: echo "Successfully pushed bytebase/bytebase:release-ci " ${{ steps.docker_build.outputs.digest }}