Skip to content

Commit e1d64d1

Browse files
committed
add custom build workflow
1 parent d04fa12 commit e1d64d1

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Refact Server CICD Build and Push
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: "Tag for docker hub"
7+
type: string
8+
required: false
9+
10+
jobs:
11+
cicl:
12+
name: Cicl
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.properties.outputs.version }}
16+
changelog: ${{ steps.properties.outputs.changelog }}
17+
steps:
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
21+
- name: Backup docker files
22+
run: |
23+
echo "backup moby/buildkit image"
24+
sudo docker image save -o ${GITHUB_WORKSPACE}/images.tar moby/buildkit
25+
echo "Back up /var/lib/docker folder structure and other files"
26+
sudo rsync -aPq /var/lib/docker/ ${GITHUB_WORKSPACE}/docker
27+
28+
# Free GitHub Actions Environment Disk Space
29+
- name: Maximize build space
30+
uses: easimon/maximize-build-space@master
31+
with:
32+
root-reserve-mb: 512
33+
temp-reserve-mb: 32
34+
swap-size-mb: 32
35+
remove-dotnet: 'true'
36+
remove-android: 'true'
37+
remove-haskell: 'true'
38+
remove-codeql: 'true'
39+
build-mount-path: '/var/lib/docker/'
40+
41+
- name: Restore docker files
42+
run: |
43+
sudo rsync -aPq ${GITHUB_WORKSPACE}/docker/ /var/lib/docker
44+
sudo rm -rf ${GITHUB_WORKSPACE}/docker
45+
sudo ls ${GITHUB_WORKSPACE} -l
46+
sudo docker image load -i ${GITHUB_WORKSPACE}/images.tar
47+
sudo rm ${GITHUB_WORKSPACE}/images.tar
48+
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Inject cache docker image
53+
working-directory: refact-server
54+
run: |
55+
./.github/scripts/cicl_docker_injection.sh
56+
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v3
59+
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
63+
- name: Login to GitHub Container Registry
64+
uses: docker/login-action@v3
65+
with:
66+
registry: ghcr.io
67+
username: ${{ secrets.GH_USER }}
68+
password: ${{ secrets.GH_TOKEN }}
69+
70+
- name: Login to DockerHub Container Registry
71+
uses: docker/login-action@v3
72+
with:
73+
username: ${{ secrets.DOCKERHUB_USER }}
74+
password: ${{ secrets.DOCKERHUB_TOKEN }}
75+
76+
- name: Build
77+
uses: docker/build-push-action@v5
78+
with:
79+
push: true
80+
context: refact-server
81+
tags: |
82+
smallcloud/refact_self_hosting:${{ inputs.tag }}
83+
platforms: |
84+
linux/amd64
85+
build-args: |
86+
GIT_COMMIT_HASH=${{ github.sha }}

0 commit comments

Comments
 (0)