Repository navigation
82 lines (70 loc) · 2.37 KB
/
Copy pathdocker.yml
File metadata and controls
82 lines (70 loc) · 2.37 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Build and Publish Docker Image
on:
workflow_dispatch:
env:
GHCR_IMAGE: ghcr.io/hackycy/hackycy-cli
TENCENT_IMAGE: sgccr.ccs.tencentyun.com/sooosin-sg/hackycy-cli
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Verify selected ref is a release tag
if: github.ref_type != 'tag'
run: |
echo 'Run this workflow from a release tag, for example v0.0.x.' >&2
exit 1
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.ref }}
- name: Download Linux binaries from GitHub Release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ github.ref_name }}
shell: bash
run: |
set -euo pipefail
mkdir -p docker-assets
gh release download "$RELEASE_TAG" \
--repo "$GITHUB_REPOSITORY" \
--pattern ycy-linux-x64 \
--pattern ycy-linux-arm64 \
--pattern SHA256SUMS \
--dir docker-assets
(cd docker-assets && grep -E ' (ycy-linux-x64|ycy-linux-arm64)$' SHA256SUMS | sha256sum -c -)
chmod +x docker-assets/ycy-linux-x64 docker-assets/ycy-linux-arm64
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version: '1.26.7'
cache: true
- name: Prepare manifest-pinned FRP runtimes
run: go run ./tools/prepare-frp-runtime --output .tmp/docker
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Login to Tencent Container Registry
uses: docker/login-action@v4
with:
registry: sgccr.ccs.tencentyun.com
username: ${{ secrets.TENCENT_USERNAME }}
password: ${{ secrets.TENCENT_PASSWORD }}
- name: Setup Buildx
uses: docker/setup-buildx-action@v4
- name: Build and publish image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.GHCR_IMAGE }}:${{ github.ref_name }}
${{ env.GHCR_IMAGE }}:latest
${{ env.TENCENT_IMAGE }}:${{ github.ref_name }}
${{ env.TENCENT_IMAGE }}:latest