From 2d2c3a53103362fd40929e5d3904da896981a7fa Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Tue, 16 Apr 2024 20:38:52 +0800 Subject: [PATCH] ci: fix getting friendly filename ci: add version number to filename ci: windows version should be win10 at least chore(docker): Publish docker images on Github Container Registry (#1425) * Temporary test * Push containers to ghcr.io via GitHub Actions * replace tabs with spaces * temporary comment out dockerhub * temporary comment out dockerhub for gui * revertme: remove non-ghcr docker image tags * convert repo owner name to lowercase * fix conversion to lowercase * fix typo, move lowercase conversion to calculate sooner * copy lowercase conversion to both jobs * fix typo * add labels to gui and dev Dockerfiles * specify correct push path for the ghcr.io * fix typo * hardcode image name * specify correct labels for upstream * add dockerhub tags * uncomment dockerhub login * restore Dockerfile.dev --- .github/workflows/release_main.yml | 62 +++++++++++++++++++------ Dockerfile | 1 + Dockerfile.gui | 1 + install/windows-inno/v2rayA-service.xml | 2 +- install/windows-inno/windows_arm64.iss | 1 + install/windows-inno/windows_x86_64.iss | 1 + 6 files changed, 53 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index a257398834..0ba8b4414c 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -95,44 +95,52 @@ jobs: shell: pwsh run: | New-Item -ItemType Directory -Path v2raya_binaries - foreach ($arch in @('amd64', 'arm64', 'arm', '386', 'riscv64', 'mips64', 'mips64le', 'mipsle', 'mips', 'loong64')) { - Set-Location -Path service + foreach ($arch in @('amd64', 'arm64', '386', 'riscv64', 'mips64', 'mips64le', 'mipsle', 'mips', 'loong64')) { $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } foreach ($arm in @('7')) { - Set-Location -Path service $env:GOARCH = 'arm' $env:GOARM = $arm $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-arm$arm")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'windows' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'darwin' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'freebsd' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."freebsd-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'openbsd' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."openbsd-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } - name: Upload Artifact @@ -186,23 +194,27 @@ jobs: run: | New-Item -ItemType Directory -Path v2raya_binaries foreach ($arch in @('amd64', 'arm64')) { - Set-Location -Path service $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" - go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'windows' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" - go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION}.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'darwin' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" - go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } - name: Upload Artifact uses: nanoufo/action-upload-artifacts-and-release-assets@v2 @@ -808,11 +820,20 @@ jobs: 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: @@ -824,6 +845,8 @@ jobs: 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: @@ -853,11 +876,20 @@ jobs: 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: @@ -866,7 +898,9 @@ jobs: file: install/docker/Dockerfile.GUI.Action platforms: linux/arm,linux/arm64,linux/amd64 push: true - tags: mzz2017/v2raya-gui:latest + 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: diff --git a/Dockerfile b/Dockerfile index 9bda944016..a15da0d053 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ FROM v2fly/v2fly-core COPY --from=builder /build/service/v2raya /usr/bin/ RUN wget -O /usr/local/share/v2ray/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat RUN apk add --no-cache iptables ip6tables tzdata +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 2017 VOLUME /etc/v2raya ENTRYPOINT ["v2raya"] diff --git a/Dockerfile.gui b/Dockerfile.gui index 1a493969fa..441e74ed43 100644 --- a/Dockerfile.gui +++ b/Dockerfile.gui @@ -5,4 +5,5 @@ RUN yarn && yarn build FROM nginx:stable-alpine COPY --from=builder /web /usr/share/nginx/html +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 80 diff --git a/install/windows-inno/v2rayA-service.xml b/install/windows-inno/v2rayA-service.xml index d7cfcee193..9df007b916 100644 --- a/install/windows-inno/v2rayA-service.xml +++ b/install/windows-inno/v2rayA-service.xml @@ -25,7 +25,7 @@ SOFTWARE. A web GUI client of Project V which supports VMess, VLESS, SS, SSR, Trojan, Tuic and Juicity protocols. %BASE%\bin\v2raya.exe - --lite --log-file "v2raya.log" --v2ray-assetsdir "%BASE%\data" --config "%BASE%" + --passcheckroot --log-file "v2raya.log" --v2ray-assetsdir "%BASE%\data" --config "%BASE%" %TEMP% diff --git a/install/windows-inno/windows_arm64.iss b/install/windows-inno/windows_arm64.iss index 889be2411a..7063d14b34 100644 --- a/install/windows-inno/windows_arm64.iss +++ b/install/windows-inno/windows_arm64.iss @@ -34,6 +34,7 @@ SolidCompression=yes UninstallDisplayName={#MyAppName}-{#MyAppVersion} WizardStyle=modern SetupIconFile=D:\v2raya.ico +MinVersion=10.0.14393 [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" diff --git a/install/windows-inno/windows_x86_64.iss b/install/windows-inno/windows_x86_64.iss index 20563409b7..0ab7c79656 100644 --- a/install/windows-inno/windows_x86_64.iss +++ b/install/windows-inno/windows_x86_64.iss @@ -34,6 +34,7 @@ SolidCompression=yes UninstallDisplayName={#MyAppName}-{#MyAppVersion} WizardStyle=modern SetupIconFile=D:\v2raya.ico +MinVersion=10.0.14393 [Languages] Name: "english"; MessagesFile: "compiler:Default.isl"