Files
Markson Hon 878ff5802e Merge pull request #2040 from Zakkaus/aur-dispatch
ci: the AUR publish is its own workflow, callable from the release and by hand
2026-09-21 22:55:35 +08:00

300 lines
11 KiB
YAML

name: Release v2rayA (Reusable)
on:
workflow_call:
inputs:
tag:
type: string
required: true
prerelease:
type: boolean
required: true
publish_downstream:
type: boolean
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@v7
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/${{ github.repository }}/releases/latest | jq -r '.tag_name')
Latest_tag=v${{ steps.prep.outputs.VERSION }}
if [ "$Latest_Releases" != "$Latest_tag" ]; then
prerelease=()
if [ "${{ inputs.prerelease }}" = "true" ]; then
prerelease+=(--prerelease)
fi
gh release create "v${{ steps.prep.outputs.VERSION }}" -t "v${{ steps.prep.outputs.VERSION }}" --generate-notes "${prerelease[@]}"
fi
gh release upload "v${{ steps.prep.outputs.VERSION }}" release/*
Release_to_Homebrew:
if: inputs.publish_downstream
runs-on: ubuntu-latest
needs: [Build_v2rayA_Binaries]
steps:
- uses: actions/checkout@v7
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 Artifacts
uses: actions/download-artifact@v8
with:
pattern: v2raya{,_core}_{linux,darwin}_{x64,arm64}_${{ steps.prep.outputs.VERSION }}
merge-multiple: true
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
cp Downloads/v2raya_core_linux_x64_${{ steps.prep.outputs.VERSION }} ./v2raya-x86_64-linux/v2raya_core
mkdir v2raya-arm64-linux; cp Downloads/v2raya_linux_arm64_${{ steps.prep.outputs.VERSION }} ./v2raya-arm64-linux/v2raya
cp Downloads/v2raya_core_linux_arm64_${{ steps.prep.outputs.VERSION }} ./v2raya-arm64-linux/v2raya_core
mkdir v2raya-x86_64-macos; cp Downloads/v2raya_darwin_x64_${{ steps.prep.outputs.VERSION }} ./v2raya-x86_64-macos/v2raya
cp Downloads/v2raya_core_darwin_x64_${{ steps.prep.outputs.VERSION }} ./v2raya-x86_64-macos/v2raya_core
mkdir v2raya-aarch64-macos; cp Downloads/v2raya_darwin_arm64_${{ steps.prep.outputs.VERSION }} ./v2raya-aarch64-macos/v2raya
cp Downloads/v2raya_core_darwin_arm64_${{ steps.prep.outputs.VERSION }} ./v2raya-aarch64-macos/v2raya_core
zip -r9 v2raya-x86_64-linux.zip ./v2raya-x86_64-linux/*
zip -r9 v2raya-arm64-linux.zip ./v2raya-arm64-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-arm64-linux.zip v2raya-arm64-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:
if: inputs.publish_downstream
runs-on: ubuntu-latest
needs: [GitHub_Release]
steps:
- uses: actions/checkout@v7
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@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v4
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@v7
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:
if: inputs.publish_downstream
runs-on: ubuntu-latest
needs: [Build_v2rayA_Web]
steps:
- uses: actions/checkout@v7
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@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v4
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@v7
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:
if: inputs.publish_downstream
runs-on: windows-latest
needs: [GitHub_Release]
steps:
- uses: actions/checkout@v7
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:
needs: [GitHub_Release]
if: inputs.publish_downstream
uses: ./.github/workflows/_release_aur.yml
with:
tag: ${{ inputs.tag }}
secrets: inherit