Files
loveuer f1411aaeae
Build and Deploy / deploy (push) Successful in 10m13s
ci: build CLI artifacts with Docker
2026-09-21 03:02:08 -07:00

62 lines
1.7 KiB
YAML

name: Build and Deploy
on:
push:
branches:
- master
jobs:
deploy:
runs-on: tencent-local
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build CLI artifact image
run: |
docker build \
--target cli-artifacts \
--build-arg GOPROXY=https://goproxy.cn,direct \
--build-arg VERSION=${{ github.sha }} \
--build-arg COMMIT=${{ github.sha }} \
-t ufile-cli-artifacts:latest .
- name: Extract CLI binaries
run: |
container="ufile-cli-artifacts-$$"
docker run -d --name "$container" ufile-cli-artifacts:latest
trap 'docker rm -f "$container" >/dev/null 2>&1 || true' EXIT
mkdir -p dist
docker cp "$container:/dist/." dist/
cd dist
sha256sum -c checksums.txt
- name: Build image
run: docker build --build-arg GOPROXY=https://goproxy.cn,direct -t ufile:latest .
- name: Stop old container
run: |
if docker container inspect ufile >/dev/null 2>&1; then
docker stop ufile
fi
- name: Remove old container
run: |
if docker container inspect ufile >/dev/null 2>&1; then
docker rm ufile
fi
- name: Start new container
run: |
mkdir -p /root/deploy/ufile/data
chown -R 10001:10001 /root/deploy/ufile/data
docker run -d \
--name ufile \
--restart unless-stopped \
-p 6616:6616 \
-v /root/deploy/ufile/data:/data \
ufile:latest \
/usr/local/bin/ufile \
--data /data \
--address 0.0.0.0:6616