new: better docker management and add more supported platforms
This commit is contained in:
151
.github/workflows/release.yml
vendored
151
.github/workflows/release.yml
vendored
@@ -11,6 +11,9 @@ on:
|
|||||||
- '.github/**'
|
- '.github/**'
|
||||||
- '!.github/workflows/release.yml'
|
- '!.github/workflows/release.yml'
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY_IMAGE: ghcr.io/hiddify/hiddify-core
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
@@ -165,97 +168,111 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref_name }}
|
tag_name: ${{ github.ref_name }}
|
||||||
|
|
||||||
files: bin/*.tar.gz
|
files: bin/*.tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
make-upload-docker:
|
make-upload-docker:
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
if: ${{ github.ref_type=='tag' }}
|
if: ${{ github.ref_type=='tag' }}
|
||||||
needs: [upload-release]
|
needs: [upload-release]
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# permissions:
|
strategy:
|
||||||
# contents: read
|
fail-fast: true
|
||||||
# packages: write
|
matrix:
|
||||||
# # This is used to complete the identity challenge
|
platform:
|
||||||
# # with sigstore/fulcio when running outside of PRs.
|
- linux/amd64
|
||||||
# id-token: write
|
- linux/arm/v5
|
||||||
|
- linux/arm/v6
|
||||||
|
- linux/arm/v7
|
||||||
|
- linux/arm64
|
||||||
|
- linux/386
|
||||||
|
# - linux/ppc64le
|
||||||
|
# - linux/riscv64
|
||||||
|
- linux/s390x
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v4
|
- name: Prepare
|
||||||
with:
|
run: |
|
||||||
merge-multiple: true
|
platform=${{ matrix.platform }}
|
||||||
pattern: hiddify-*
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
path: bin/
|
- name: Setup QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Setup Docker Buildx
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# Install the cosign tool except on PR
|
|
||||||
# https://github.com/sigstore/cosign-installer
|
|
||||||
- name: Install cosign
|
|
||||||
|
|
||||||
uses: sigstore/cosign-installer@v3
|
|
||||||
with:
|
|
||||||
cosign-release: 'v2.1.1'
|
|
||||||
|
|
||||||
# Set up BuildKit Docker container builder to be able to build
|
|
||||||
# multi-platform images and export cache
|
|
||||||
# https://github.com/docker/setup-buildx-action
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
# Login against a Docker registry except on PR
|
uses: docker/login-action@v3
|
||||||
# https://github.com/docker/login-action
|
|
||||||
- name: Log into registry ghcr.io
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Docker meta
|
||||||
# Extract metadata (tags, labels) for Docker
|
|
||||||
# https://github.com/docker/metadata-action
|
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/hiddify/hiddify-core
|
images: ${{ env.REGISTRY_IMAGE }}
|
||||||
|
- name: Build and push by digest
|
||||||
# Build and push Docker image with Buildx (don't push on PR)
|
id: build
|
||||||
# https://github.com/docker/build-push-action
|
|
||||||
- name: Build and push Docker image
|
|
||||||
id: build-and-push
|
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
context: ./docker/
|
context: ./docker/
|
||||||
push: true
|
build-args: |
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: Export digest
|
- name: Export digest
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/digests
|
mkdir -p /tmp/digests
|
||||||
digest="${{ steps.build-and-push.outputs.digest }}"
|
digest="${{ steps.build.outputs.digest }}"
|
||||||
touch "/tmp/digests/${digest#sha256:}"
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
- name: Upload digest
|
- name: Upload digest
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: digests
|
name: digests-${{ env.PLATFORM_PAIR }}
|
||||||
path: /tmp/digests/*
|
path: /tmp/digests/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
# Sign the resulting Docker image digest except on PRs.
|
merge:
|
||||||
# This will only write to the public Rekor transparency log when the Docker
|
permissions: write-all
|
||||||
# repository is public to avoid leaking data. If you would like to publish
|
runs-on: ubuntu-latest
|
||||||
# transparency data even for private images, pass --force to cosign below.
|
needs:
|
||||||
# https://github.com/sigstore/cosign
|
- make-upload-docker
|
||||||
- name: Sign the published Docker image
|
env:
|
||||||
env:
|
LATEST: ${{ endsWith(github.ref_name, 'dev') && 'beta' ||'latest'}}
|
||||||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
|
steps:
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
- name: Download digests
|
||||||
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
uses: actions/download-artifact@v4
|
||||||
# This step uses the identity token to provision an ephemeral certificate
|
with:
|
||||||
# against the sigstore community Fulcio instance.
|
path: /tmp/digests
|
||||||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
|
pattern: digests-*
|
||||||
|
merge-multiple: true
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Create manifest list and push
|
||||||
|
working-directory: /tmp/digests
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools create \
|
||||||
|
-t "${{ env.REGISTRY_IMAGE }}:${{ env.LATEST }}" \
|
||||||
|
-t "${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}" \
|
||||||
|
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
||||||
|
- name: Inspect image
|
||||||
|
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ env.LATEST }}
|
||||||
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ RUN apk add curl tar gzip libc6-compat # iptables ip6tables
|
|||||||
RUN case "$(apk --print-arch)" in \
|
RUN case "$(apk --print-arch)" in \
|
||||||
x86_64) ARCH=amd64 ;; \
|
x86_64) ARCH=amd64 ;; \
|
||||||
i386) ARCH=386 ;; \
|
i386) ARCH=386 ;; \
|
||||||
armv7) ARCH=arm ;; \
|
|
||||||
aarch64) ARCH=arm64 ;; \
|
aarch64) ARCH=arm64 ;; \
|
||||||
|
armv7) ARCH=armv7 ;; \
|
||||||
|
armv6) ARCH=armv6 ;;
|
||||||
|
armv5) ARCH=armv5 ;;
|
||||||
|
s390x) ARCH=s390x ;;\
|
||||||
*) echo "Unsupported architecture: $(apk --print-arch) $(uname -m)" && exit 1 ;; \
|
*) echo "Unsupported architecture: $(apk --print-arch) $(uname -m)" && exit 1 ;; \
|
||||||
esac && \
|
esac && \
|
||||||
curl -L -o hiddify-cli.tar.gz https://github.com/hiddify/hiddify-core/releases/download/${VERSION}/hiddify-cli-linux-$ARCH.tar.gz && \
|
curl -L -o hiddify-cli.tar.gz https://github.com/hiddify/hiddify-core/releases/download/${VERSION}/hiddify-cli-linux-$ARCH.tar.gz && \
|
||||||
|
|||||||
Reference in New Issue
Block a user