Files
Archive/v2raya/.github/workflows/release_main.yml
T
2026-04-19 21:03:22 +02:00

328 lines
12 KiB
YAML

name: Build & Release v2rayA
on:
workflow_dispatch:
inputs:
tag:
type: string
description: 'The tag to release'
required: true
jobs:
Build_v2rayA_Web:
uses: ./.github/workflows/_build_web.yml
with:
upload_archive: true
Compute_Version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.prep.outputs.VERSION }}
steps:
- name: Compute Version
id: prep
run: |
tag=${{ inputs.tag }}
version=$(echo $tag | sed 's/v//g')
echo "VERSION=$version" >> $GITHUB_OUTPUT
Build_v2rayA_Binaries:
needs: [Build_v2rayA_Web, Compute_Version]
uses: ./.github/workflows/_build_binaries.yml
with:
version: ${{ needs.Compute_Version.outputs.version }}
Build_Windows_Installers:
needs: [Build_v2rayA_Binaries, Compute_Version]
uses: ./.github/workflows/_build_windows_installer.yml
with:
version: ${{ needs.Compute_Version.outputs.version }}
Build_Linux_Packages:
needs: [Build_v2rayA_Binaries, Compute_Version]
uses: ./.github/workflows/_build_linux_packages.yml
with:
version: ${{ needs.Compute_Version.outputs.version }}
GitHub_Release:
runs-on: ubuntu-latest
needs: [Build_v2rayA_Binaries, Build_Windows_Installers, Build_Linux_Packages]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check Version
id: prep
env:
REF: ${{ inputs.tag }}
run: |
tag=${{ inputs.tag }}
version=$(echo $tag | sed 's/v//g')
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
- name: Download Artifacts
uses: actions/download-artifact@v8
with:
path: builds/
- name: Move Files to Release Directory
shell: bash
run: |
mkdir -p release
for file in $(ls builds | grep -E "^installer|^v2raya"); do
mv builds/$file/$file release/
done
mv builds/web.tar.gz/web.tar.gz release/
for file in $(ls release); do
sha256sum release/$file | awk '{print $1}' > release/$file.sha256.txt
done
ls -l release/
- name: Compress Web Files
shell: pwsh
run: |
Compress-Archive -Path ./builds/web/* -DestinationPath ./web.zip
((Get-FileHash ./web.zip).hash).ToLower() > web.zip.sha256.txt
Move-Item ./web.zip ./release/web.zip
Move-Item ./web.zip.sha256.txt ./release/web.zip.sha256.txt
- name: Upload Release
env:
GH_TOKEN: ${{ github.token }}
run: |
Latest_Releases=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/v2rayA/v2rayA/releases/latest | jq -r '.tag_name')
Latest_tag=v${{ steps.prep.outputs.VERSION }}
if [ "$Latest_Releases" != "$Latest_tag" ]; then
gh release create "v${{ steps.prep.outputs.VERSION }}" -t "v${{ steps.prep.outputs.VERSION }}" --generate-notes
fi
gh release upload "v${{ steps.prep.outputs.VERSION }}" 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}'
Release_to_Homebrew:
runs-on: ubuntu-latest
needs: [Build_v2rayA_Binaries]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check Version
id: prep
shell: bash
env:
REF: ${{ inputs.tag }}
run: |
tag=${{ inputs.tag }}
version=$(echo $tag | sed 's/v//g')
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
- name: Download Artifact Linux x64
uses: actions/download-artifact@v8
with:
name: v2raya_linux_x64_${{ steps.prep.outputs.VERSION }}
path: Downloads
- name: Download Artifact macOS x64
uses: actions/download-artifact@v8
with:
name: v2raya_darwin_x64_${{ steps.prep.outputs.VERSION }}
path: Downloads
- name: Download Artifact macOS arm64
uses: actions/download-artifact@v8
with:
name: v2raya_darwin_arm64_${{ steps.prep.outputs.VERSION }}
path: Downloads
- name: Compress to Zip Files
run: |
mkdir v2raya-x86_64-linux; cp Downloads/v2raya_linux_x64_${{ steps.prep.outputs.VERSION }} ./v2raya-x86_64-linux/v2raya
mkdir v2raya-x86_64-macos; cp Downloads/v2raya_darwin_x64_${{ steps.prep.outputs.VERSION }} ./v2raya-x86_64-macos/v2raya
mkdir v2raya-aarch64-macos; cp Downloads/v2raya_darwin_arm64_${{ steps.prep.outputs.VERSION }} ./v2raya-aarch64-macos/v2raya
zip -r9 v2raya-x86_64-linux.zip ./v2raya-x86_64-linux/*
zip -r9 v2raya-x86_64-macos.zip ./v2raya-x86_64-macos/*
zip -r9 v2raya-aarch64-macos.zip ./v2raya-aarch64-macos/*
for file in $(ls v2raya-*.zip); do
sha256sum $file > $file.sha256.txt
done
- name: Upload to Homebrew Tap
env:
GH_TOKEN: ${{ secrets.HOMEBREW_V2RAYA_TOKEN }}
run: |
tag_version=$(echo $VERSION | sed 's/v//g')
gh release create $tag_version --repo v2rayA/homebrew-v2raya \
--title "Releases $VERSION" --generate-notes
gh release upload $tag_version --repo v2rayA/homebrew-v2raya \
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_v2rayA_to_Docker:
runs-on: ubuntu-latest
needs: [GitHub_Release]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check Version
id: prep
run: |
tag=${{ inputs.tag }}
version=$(echo $tag | sed 's/v//g')
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
IMAGE="mzz2017/v2raya"
echo image=${IMAGE} >> $GITHUB_OUTPUT
echo tag=${{ inputs.tag }} >> $GITHUB_OUTPUT
sed -i "s|Realv2rayAVersion|$version|g" install/docker/docker_helper.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Login to GitHub container registry
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Convert repository owner to lowercase
run: |
echo "LOWERCASE_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV}
- name: Build and push
uses: docker/build-push-action@v5.0.0
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: install/docker/Dockerfile.Action
platforms: linux/arm,linux/arm64,linux/amd64,linux/riscv64
push: true
tags: |
${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.tag }}
${{ steps.prep.outputs.image }}:latest
ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya:${{ steps.prep.outputs.tag }}
ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Release_v2rayA_GUI_to_Docker:
runs-on: ubuntu-latest
needs: [Build_v2rayA_Web]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check Version
id: prep
env:
REF: ${{ inputs.tag }}
run: |
tag=${{ inputs.tag }}
version=$(echo $tag | sed 's/v//g')
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
- name: Download Web Files
uses: actions/download-artifact@v8
with:
name: web
path: web
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Login to GitHub container registry
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Convert repository owner to lowercase
run: |
echo "LOWERCASE_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV}
- name: Build and push
uses: docker/build-push-action@v5.0.0
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: install/docker/Dockerfile.GUI.Action
platforms: linux/arm,linux/arm64,linux/amd64,linux/riscv64
push: true
tags: |
mzz2017/v2raya-gui:latest
ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya-gui:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Submit_to_Microsoft_winget:
runs-on: windows-latest
needs: [GitHub_Release]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check Version
id: prep
shell: bash
env:
REF: ${{ inputs.tag }}
run: |
tag=${{ inputs.tag }}
version=$(echo $tag | sed 's/v//g')
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
- name: Submit to Microsoft winget
shell: pwsh
run: |
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
$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
Release_to_AUR:
runs-on: ubuntu-latest
needs: [GitHub_Release]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check Version
id: prep
shell: bash
env:
REF: ${{ inputs.tag }}
run: |
tag=${{ inputs.tag }}
version=$(echo $tag | sed 's/v//g')
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION=$version" >> $GITHUB_ENV
- name: Download v2rayA binary for checksum
run: |
mkdir v2raya_linux
for arch in x86 x64 loongarch64 armv7 arm64; do
curl -L https://github.com/v2rayA/v2rayA/releases/download/v${VERSION}/v2raya_linux_${arch}_${VERSION} -o v2raya_linux/v2raya_linux_${arch}_${VERSION}
chmod +x v2raya_linux/v2raya_linux_${arch}_${VERSION}
done
- name: List Files and Install expect
run: |
sudo apt update -y && sudo apt install -y expect >/dev/null
ls -l v2raya_linux
echo "P_DIR=$(pwd)" >> $GITHUB_ENV
echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT
id: set_path
- name: Release to AUR
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
run: |
eval $(ssh-agent)
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ./key
chmod 0600 ./key
./install/tool/ssh-add_expect ./key
bash install/aur/deploy.sh