Files
v2rayA/.github/workflows/release.yml
T
2021-09-16 01:23:05 +08:00

180 lines
10 KiB
YAML

name: Release
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
env:
NODE_VERSION: "lts/*"
GO111MODULE: on
NAME: v2raya
DESC: "A web GUI client of Project V which supports VMess, VLESS, SS, SSR, Trojan and Pingtunnel protocols."
CF_AUTH_EMAIL: ${{ secrets.CF_AUTH_EMAIL }}
CF_PARGE_CACHE_AUTH_KEY: ${{ secrets.CF_PARGE_CACHE_AUTH_KEY }}
CF_ZONE: ${{ secrets.CF_ZONE }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Prepare
id: prep
run: |
echo ::set-output name=P_DIR::$(pwd)
TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
echo ::set-output name=version::${TAG:1}
echo "VERSION=${TAG:1}" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.17
- name: Set up Node.js
uses: actions/setup-node@v2.4.0
with:
node-version: lts/*
cache: 'yarn'
cache-dependency-path: gui/yarn.lock
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
with:
ruby-version: 2.7
bundler-cache: true
- name: Install Build Dependencies
run: |
go install github.com/mitchellh/gox@latest
gem install fpm -v 1.13.1
sudo apt-get install -y libarchive-tools rpm lintian reprepro gnupg gnupg2 expect tar
- name: Build GUI
run: |
yarn --cwd gui --check-files
yarn --cwd gui build
- name: Build V2rayA Binaries
run: |
cp -r web service/server/router/
cd service
CGO_ENABLED=0 gox -osarch="linux/386 linux/amd64 linux/arm linux/arm64" -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=$VERSION -s -w" -output="../v2raya_{{.OS}}_{{.Arch}}_$VERSION"
- name: Rename Binaries to Friendly Filenames
run: |
mv v2raya_linux_386_$VERSION v2raya_linux_x86_$VERSION
mv v2raya_linux_amd64_$VERSION v2raya_linux_x64_$VERSION
- name: Package
run: |
export FILES="install/universal/v2raya.service=/etc/systemd/system/v2raya.service install/universal/v2raya@.service=/etc/systemd/system/v2raya@.service install/universal/v2raya.png=/usr/share/icons/hicolor/512x512/apps/v2raya.png install/universal/v2raya.desktop=/usr/share/applications/v2raya.desktop"
export PARAMS="--maintainer v2rayA --after-install install/universal/after_install.sh --after-upgrade install/universal/after_upgrade.sh --verbose -f -n $NAME -v $VERSION --url https://github.com/v2rayA/v2raya"
tar -zcvf web.tar.gz web/
fpm -s dir -t deb -p installer_debian_x86_$VERSION.deb --description "$DESC" --architecture=i386 $PARAMS v2raya_linux_x86_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t deb -p installer_debian_x64_$VERSION.deb --description "$DESC" --architecture=amd64 $PARAMS v2raya_linux_x64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t deb -p installer_debian_armel_$VERSION.deb --description "$DESC" --architecture=armel $PARAMS v2raya_linux_arm_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t deb -p installer_debian_armhf_$VERSION.deb --description "$DESC" --architecture=armhf $PARAMS v2raya_linux_arm_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t deb -p installer_debian_arm64_$VERSION.deb --description "$DESC" --architecture=arm64 $PARAMS v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t deb -p installer_debian_armv8_$VERSION.deb --description "$DESC" --architecture=armv8 $PARAMS v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t rpm -p installer_redhat_x86_$VERSION.rpm --description "$DESC" --architecture=i386 $PARAMS v2raya_linux_x86_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t rpm -p installer_redhat_x64_$VERSION.rpm --description "$DESC" --architecture=amd64 $PARAMS v2raya_linux_x64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t rpm -p installer_redhat_armel_$VERSION.rpm --description "$DESC" --architecture=armel $PARAMS v2raya_linux_arm_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t rpm -p installer_redhat_armhf_$VERSION.rpm --description "$DESC" --architecture=armhf $PARAMS v2raya_linux_arm_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t rpm -p installer_redhat_aarch64_$VERSION.rpm --description "$DESC" --architecture=aarch64 $PARAMS v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t rpm -p installer_redhat_armv8_$VERSION.rpm --description "$DESC" --architecture=armv8 $PARAMS v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t pacman -p installer_archlinux_x86_$VERSION.pkg.tar.zstd --description "$DESC" --architecture=i386 $PARAMS v2raya_linux_x86_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t pacman -p installer_archlinux_x64_$VERSION.pkg.tar.zstd --description "$DESC" --architecture=amd64 $PARAMS v2raya_linux_x64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t pacman -p installer_archlinux_armel_$VERSION.pkg.tar.zstd --description "$DESC" --architecture=armel $PARAMS v2raya_linux_arm_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t pacman -p installer_archlinux_armhf_$VERSION.pkg.tar.zstd --description "$DESC" --architecture=armhf $PARAMS v2raya_linux_arm_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t pacman -p installer_archlinux_aarch64_$VERSION.pkg.tar.zstd --description "$DESC" --architecture=aarch64 $PARAMS v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t pacman -p installer_archlinux_arm64_$VERSION.pkg.tar.zstd --description "$DESC" --architecture=arm64 $PARAMS v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t pacman -p installer_archlinux_armv8_$VERSION.pkg.tar.zstd --description "$DESC" --architecture=armv8 $PARAMS v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t freebsd -p installer_freebsd_x86_$VERSION.txz $PARAMS --description "$DESC" --architecture=i386 v2raya_linux_x86_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t freebsd -p installer_freebsd_x64_$VERSION.txz $PARAMS --description "$DESC" --architecture=amd64 v2raya_linux_x64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t freebsd -p installer_freebsd_armel_$VERSION.txz $PARAMS --description "$DESC" --architecture=armel v2raya_linux_arm_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t freebsd -p installer_freebsd_armhf_$VERSION.txz $PARAMS --description "$DESC" --architecture=armhf v2raya_linux_arm_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t freebsd -p installer_freebsd_aarch64_$VERSION.txz $PARAMS --description "$DESC" --architecture=aarch64 v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t freebsd -p installer_freebsd_arm64_$VERSION.txz $PARAMS --description "$DESC" --architecture=arm64 v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
fpm -s dir -t freebsd -p installer_freebsd_armv8_$VERSION.txz $PARAMS --description "$DESC" --architecture=armv8 v2raya_linux_arm64_$VERSION=/usr/bin/v2raya $FILES
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SIGNING_PASSWORD }}
- name: Generate APT repository
run: |
mkdir -p apt/incoming && cp -r install/debian/key install/debian/conf apt/
install/tool/reprepro_expect --ask-passphrase -Vb apt includedeb v2raya installer_debian_*_$VERSION.deb
install/tool/reprepro_expect --ask-passphrase -Vb apt export
cp v2raya_linux_*_$VERSION apt/pool/main/v/v2raya/
cp web.tar.gz apt/pool/main/v/v2raya/web_$VERSION.tar.gz
echo "apt.v2raya.mzz.pub" > apt/CNAME
- name: Deploy APT repository
uses: crazy-max/ghaction-github-pages@v2.5.0
with:
repo: v2rayA/v2raya-apt
target_branch: master
build_dir: apt
env:
GH_PAT: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Deploy Demo Site repository
uses: crazy-max/ghaction-github-pages@v2.5.0
with:
repo: v2rayA/v2raya-web
target_branch: master
build_dir: web
env:
GH_PAT: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Import SSH key
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: AUR Release
env:
P_DIR: ${{ steps.get_filename.outputs.P_DIR }}
run: bash install/aur/deploy.sh
- name: Github Release
uses: softprops/action-gh-release@v1
with:
files: |
v2raya_linux_x86_$VERSION
v2raya_linux_x64_$VERSION
v2raya_linux_arm_$VERSION
v2raya_linux_arm64_$VERSION
installer_debian_x86_$VERSION.deb
installer_debian_x64_$VERSION.deb
installer_debian_armel_$VERSION.deb
installer_debian_armhf_$VERSION.deb
installer_debian_arm64_$VERSION.deb
installer_debian_armv8_$VERSION.deb
installer_freebsd_x86_$VERSION.txz
installer_freebsd_x64_$VERSION.txz
installer_freebsd_armel_$VERSION.txz
installer_freebsd_armhf_$VERSION.txz
installer_freebsd_aarch64_$VERSION.txz
installer_freebsd_arm64_$VERSION.txz
installer_freebsd_armv8_$VERSION.txz
installer_redhat_x86_$VERSION.rpm
installer_redhat_x64_$VERSION.rpm
installer_redhat_armel_$VERSION.rpm
installer_redhat_armhf_$VERSION.rpm
installer_redhat_aarch64_$VERSION.rpm
installer_redhat_armv8_$VERSION.rpm
installer_archlinux_x86_$VERSION.pkg.tar.zstd
installer_archlinux_x64_$VERSION.pkg.tar.zstd
installer_archlinux_armel_$VERSION.pkg.tar.zstd
installer_archlinux_armhf_$VERSION.pkg.tar.zstd
installer_archlinux_aarch64_$VERSION.pkg.tar.zstd
installer_archlinux_arm64_$VERSION.pkg.tar.zstd
installer_archlinux_armv8_$VERSION.pkg.tar.zstd
- name: Refresh Cloudflare Cache
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}'