Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 0 additions & 113 deletions .github/workflows/Publish Docker image.yml

This file was deleted.

158 changes: 141 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ on:
workflow_dispatch:
push:
branches:
- master
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
- ".github/workflows/release.yml"
pull_request:
types: [opened, synchronize, reopened]
- main
paths:
- "**/*.go"
- "go.mod"
Expand All @@ -21,8 +14,38 @@ on:
types: [published]

jobs:
create-release:
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate version
id: version
run: |
DATE=$(date +%Y%m%d)
COMMIT=$(git rev-parse --short=7 HEAD)
VERSION="v${DATE}-${COMMIT}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
body: ${{ github.event.head_commit.message }}
draft: false
prerelease: false


build:
needs: [create-release]
if: always() && (needs.create-release.result == 'success' || github.event_name == 'release' || github.event_name == 'workflow_dispatch')
strategy:
matrix:
# Include amd64 on all platforms.
Expand Down Expand Up @@ -113,14 +136,15 @@ jobs:
- name: Get project dependencies
run: |
go mod download
- name: Get release version
if: ${{ github.event_name == 'release' }}
- name: Get version
run: |
echo "version=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
- name: Get other version
if: ${{ github.event_name != 'release' }}
run: |
echo "version=${{ github.sha }}" >> $GITHUB_ENV
if [ "${{ github.event_name }}" == "release" ]; then
echo "version=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "push" ]; then
echo "version=${{ needs.create-release.outputs.version }}" >> $GITHUB_ENV
else
echo "version=${{ github.sha }}" >> $GITHUB_ENV
fi
- name: Build v2node
run: |
echo "version: $version"
Expand Down Expand Up @@ -173,9 +197,109 @@ jobs:
./v2node-${{ steps.get_filename.outputs.ASSET_NAME }}/*
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release'
if: github.event_name == 'release' || github.event_name == 'push'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./v2node-${{ steps.get_filename.outputs.ASSET_NAME }}.zip*
tag: ${{ github.ref }}
tag: ${{ github.event_name == 'release' && github.ref || needs.create-release.outputs.version }}
file_glob: true

docker-build:
needs: [build]
if: github.event_name == 'release' || github.event_name == 'push'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/v2node

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=ghcr.io/${{ github.repository_owner }}/v2node,push-by-digest=true,name-canonical=true,push=true

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
echo "${digest#sha256:}" > "/tmp/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

docker-merge:
needs: [docker-build]
runs-on: ubuntu-latest
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/v2node

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create manifest list and push
run: |
cd /tmp/digests
tags=$(echo '${{ steps.meta.outputs.json }}' | jq -cr '.tags | map("-t " + .) | join(" ")')
images=$(printf "ghcr.io/${{ github.repository_owner }}/v2node@sha256:%s " $(find . -type f -exec cat {} \;))
echo "Creating manifest with tags: $tags"
echo "Using images: $images"
docker buildx imagetools create $tags $images

- name: Inspect image
run: |
docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/v2node:${{ steps.meta.outputs.version }}
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
# v2node
A v2board backend base on moddified xray-core.
# v2node (修改版)

基于 [wyx2685/v2node](https://github.com/wyx2685/v2node) 的自用修改版本。

一个基于修改版xray内核的V2board节点服务端。

**注意: 本项目需要搭配[修改版V2board](https://github.com/wyx2685/v2board)**
## 感谢

- [wyx2685/v2node](https://github.com/wyx2685/v2node) - 原版项目

**注意: 本项目搭配自用的 Xboard 路由插件使用**

## 软件安装

### 一键安装

```
wget -N https://raw.githubusercontent.com/wyx2685/v2node/master/script/install.sh && bash install.sh
wget -N https://raw.githubusercontent.com/missish/v2node/main/script/install.sh && bash install.sh
```

## 构建
``` bash

```bash
GOEXPERIMENT=jsonv2 go build -v -o build_assets/v2node -trimpath -ldflags "-X 'github.com/wyx2685/v2node/cmd.version=$version' -s -w -buildid="
```

## Stars 增长记录

[![Stargazers over time](https://starchart.cc/wyx2685/v2node.svg?variant=adaptive)](https://starchart.cc/wyx2685/v2node)
[![Stargazers over time](https://starchart.cc/missish/v2node.svg?variant=adaptive)](https://starchart.cc/missish/v2node)
Loading