Skip to content

Commit

Permalink
ci(release_main.yml): add Docker workflows
Browse files Browse the repository at this point in the history
ci(docker*.yml): remove stable single docker ci workflows
  • Loading branch information
Markson Hon committed Nov 12, 2023
1 parent 4af410d commit 0abe62d
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 80 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/dockerimage_gui.yml

This file was deleted.

118 changes: 76 additions & 42 deletions .github/workflows/release_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -426,26 +426,26 @@ jobs:
tag_name: v${{ steps.prep.outputs.VERSION }}
files: |
release/*
- name: Refresh Cloudflare Cache
env:
CF_AUTH_EMAIL: ${{ secrets.CF_AUTH_EMAIL }}
CF_PARGE_CACHE_AUTH_KEY: ${{ secrets.CF_PARGE_CACHE_AUTH_KEY }}
CF_ZONE: ${{ secrets.CF_ZONE }}
shell: bash
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CF_ZONE/purge_cache" \
-H "X-Auth-Email: $CF_AUTH_EMAIL" \
-H "Authorization: Bearer $CF_PARGE_CACHE_AUTH_KEY" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
- name: Submit to Microsoft winget
shell: pwsh
run: |
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
Start-Sleep -Seconds 30 #Make sure GitHub releases are online
$Installer_x64_url = "https://github.com/v2rayA/v2rayA/releases/download/v${{ steps.prep.outputs.VERSION }}/installer_windows_inno_x64_${{ steps.prep.outputs.VERSION }}.exe"
$Installer_ARM64_url = "https://github.com/v2rayA/v2rayA/releases/download/v${{ steps.prep.outputs.VERSION }}/installer_windows_inno_arm64_${{ steps.prep.outputs.VERSION }}.exe"
./wingetcreate.exe update v2rayA.v2rayA --urls $Installer_x64_url $Installer_ARM64_url --version ${{ steps.prep.outputs.VERSION }} --token ${{ secrets.HOMEBREW_V2RAYA_TOKEN }} --submit
# - name: Refresh Cloudflare Cache
# env:
# CF_AUTH_EMAIL: ${{ secrets.CF_AUTH_EMAIL }}
# CF_PARGE_CACHE_AUTH_KEY: ${{ secrets.CF_PARGE_CACHE_AUTH_KEY }}
# CF_ZONE: ${{ secrets.CF_ZONE }}
# shell: bash
# run: |
# curl -X POST "https://api.cloudflare.com/client/v4/zones/$CF_ZONE/purge_cache" \
# -H "X-Auth-Email: $CF_AUTH_EMAIL" \
# -H "Authorization: Bearer $CF_PARGE_CACHE_AUTH_KEY" \
# -H "Content-Type: application/json" \
# --data '{"purge_everything":true}'
# - name: Submit to Microsoft winget
# shell: pwsh
# run: |
# iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
# Start-Sleep -Seconds 30 #Make sure GitHub releases are online
# $Installer_x64_url = "https://github.com/v2rayA/v2rayA/releases/download/v${{ steps.prep.outputs.VERSION }}/installer_windows_inno_x64_${{ steps.prep.outputs.VERSION }}.exe"
# $Installer_ARM64_url = "https://github.com/v2rayA/v2rayA/releases/download/v${{ steps.prep.outputs.VERSION }}/installer_windows_inno_arm64_${{ steps.prep.outputs.VERSION }}.exe"
# ./wingetcreate.exe update v2rayA.v2rayA --urls $Installer_x64_url $Installer_ARM64_url --version ${{ steps.prep.outputs.VERSION }} --token ${{ secrets.HOMEBREW_V2RAYA_TOKEN }} --submit
Build_v2ray_Debian_Packages:
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
Expand Down Expand Up @@ -714,9 +714,9 @@ jobs:
v2raya-x86_64-linux.zip v2raya-x86_64-linux.zip.sha256.txt \
v2raya-x86_64-macos.zip v2raya-x86_64-macos.zip.sha256.txt \
v2raya-aarch64-macos.zip v2raya-aarch64-macos.zip.sha256.txt
Release_to_Docker:
Release_v2rayA_to_Docker:
runs-on: ubuntu-22.04
needs: [Build_v2rayA_Binaries]
needs: [GitHub_Release]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
Expand All @@ -725,30 +725,60 @@ jobs:
- name: Check Version
id: prep
run: |
echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT
tag=$(git describe --tags $(git rev-list --tags --max-count=1))
version=${tag:1}
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
IMAGE="mzz2017/v2raya"
echo image=${IMAGE} >> $GITHUB_OUTPUT
echo tag=${TAG:1} >> $GITHUB_OUTPUT
- name: Download Artifact Linux x64
uses: actions/download-artifact@v3
echo tag=${TAG} >> $GITHUB_OUTPUT
sed -i "s|Realv2rayAVersion|$version|g" install/docker/docker_helper.sh
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
name: v2raya_linux_x64_${{ steps.prep.outputs.VERSION }}
path: Downloads
- name: Download Artifact Linux arm64
uses: actions/download-artifact@v3
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/[email protected]
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: install/docker/Dockerfile.Action
platforms: linux/arm,linux/arm64,linux/amd64
push: true
tags: |
${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.tag }}
${{ steps.prep.outputs.image }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Release_v2rayA_GUI_to_Docker:
runs-on: ubuntu-22.04
needs: [GitHub_Release]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
with:
name: v2raya_linux_arm64_${{ steps.prep.outputs.VERSION }}
path: Downloads
- name: Download Artifact Linux armv7
fetch-depth: 0
- name: Check Version
id: prep
run: |
tag=$(git describe --tags $(git rev-list --tags --max-count=1))
version=${tag:1}
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
IMAGE="mzz2017/v2raya-gui"
echo image=${IMAGE} >> $GITHUB_OUTPUT
- name: Download Web Files
uses: actions/download-artifact@v3
with:
name: v2raya_linux_armv7_${{ steps.prep.outputs.VERSION }}
path: Downloads
name: web
path: web
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
Expand All @@ -758,10 +788,14 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Images
shell: bash
run: |
Current_Path=$(pwd)
mkdir build_docker && cd build_docker && mkdir build
cat $Current_Path/install/docker/Dockerfile.Action | sed s/Real_v2rayA_PATH/$Current_Path/Downloads/v2raya_linux_x64_${{ steps.prep.outputs.VERSION }}/g > Dockerfile.Action_x64
docker buildx build --platform linux/amd64 -f Dockerfile.Action_x64 -t $IMAGE:$TAG ./build
- name: Build and push
uses: docker/[email protected]
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: install/docker/Dockerfile.GUI.Action
platforms: linux/arm,linux/arm64,linux/amd64
push: true
tags: mzz2017/v2raya-gui:latest
cache-from: type=gha
cache-to: type=gha,mode=max
10 changes: 6 additions & 4 deletions install/docker/Dockerfile.Action
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM alpine:latest
FROM alpine:latest AS builder
WORKDIR /build
COPY ./install/docker/docker_helper.sh ./docker_helper.sh
RUN sh -c "$(cat ./docker_helper.sh)"
RUN apk add --no-cache iptables ip6tables nftables
COPY Real_v2rayA_PATH /usr/bin/v2raya
CMD [“/usr/bin/v2raya”]
RUN rm ./docker_helper.sh
EXPOSE 2017
VOLUME /etc/v2raya
ENTRYPOINT ["v2raya"]
ENTRYPOINT ["v2raya"]
4 changes: 4 additions & 0 deletions install/docker/Dockerfile.GUI.Action
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx:stable-alpine
WORKDIR /build
COPY ./web /usr/share/nginx/html
EXPOSE 80
35 changes: 35 additions & 0 deletions install/docker/docker_helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
set -x
current_dir=$(pwd)
mkdir "$current_dir"/cache && cd "$current_dir"/cache || exit
case "$(arch)" in
x86_64)
v2ray_arch="64"
v2raya_arch="x64"
;;
armv7l)
v2ray_arch="arm32-v7a"
v2raya_arch="armv7"
;;
aarch64)
v2ray_arch="arm64-v8a"
v2raya_arch="arm64"
;;
*)
;;
esac
wget https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-$v2ray_arch.zip
wget https://github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-$v2ray_arch.zip
wget https://github.com/v2rayA/v2rayA/releases/download/vRealv2rayAVersion/v2raya_linux_"$v2raya_arch"_Realv2rayAVersion
unzip v2ray-linux-"$v2ray_arch".zip -d v2ray
install ./v2ray/v2ray /usr/local/bin/v2ray
unzip Xray-linux-"$v2ray_arch".zip -d xray
install ./xray/xray /usr/local/bin/xray
install ./v2raya_linux_"$v2raya_arch"_Realv2rayAVersion /usr/bin/v2raya
mkdir /usr/local/share/v2raya
ln -s /usr/local/share/v2ray /usr/local/share/v2raya
ln -s /usr/local/share/xray /usr/local/share/v2raya
wget -O /usr/local/share/v2raya/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat
wget -O /usr/local/share/v2raya/geosite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat
wget -O /usr/local/share/v2raya/geoip.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geoip.dat
cd "$current_dir" && rm -rf "$current_dir"/cache

0 comments on commit 0abe62d

Please sign in to comment.