diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 5906659..2095fea 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -12,7 +12,7 @@ jobs: prepare: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: 加载版本号 run: | if [ -f DEV-VERSION ]; then @@ -21,7 +21,7 @@ jobs: echo "DEV-VERSION file not found!" && exit 1 fi - name: 输出版本号 - run: | + run: | echo "Version: ${{ env.VERSION }}" - name: 预先创建Pre-release id: create_release @@ -46,10 +46,9 @@ jobs: goarch: [amd64, arm64] env: OUTPUT_BINARY: ghproxy - GO_VERSION: 1.25 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: ref: dev - name: 加载版本号 @@ -63,11 +62,11 @@ jobs: run: | sudo git clone https://github.com/WJQSERVER-STUDIO/GHProxy-Frontend.git pages sudo rm -rf pages/.git/ - + - name: 安装 Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod - name: 编译 env: GOOS: ${{ matrix.goos }} @@ -83,7 +82,7 @@ jobs: tar -czf ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}}.tar.gz -C ghproxyd . ls - name: 上传Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}} path: | @@ -100,8 +99,8 @@ jobs: prerelease: true body: ${{ env.VERSION }} env: - export PATH: $PATH:/usr/local/go/bin - + export PATH: $PATH:/usr/local/go/bin + docker: runs-on: ubuntu-latest needs: build @@ -109,10 +108,10 @@ jobs: IMAGE_NAME: wjqserver/ghproxy DOCKERFILE: docker/dockerfile/dev/Dockerfile DOCKERFILE_PATH: docker/dockerfile/dev - + steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: dev - name: Load VERSION @@ -121,26 +120,26 @@ jobs: echo "VERSION=$(cat DEV-VERSION)" >> $GITHUB_ENV else echo "DEV-VERSION file not found!" && exit 1 - fi + fi - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Login to Docker Hub - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: 构建镜像 - uses: docker/build-push-action@v6 + uses: docker/build-push-action@v7 with: file: ./${{ env.DOCKERFILE }} platforms: linux/amd64,linux/arm64 push: true - tags: | + tags: | ${{ env.IMAGE_NAME }}:${{ env.VERSION }} - ${{ env.IMAGE_NAME }}:dev \ No newline at end of file + ${{ env.IMAGE_NAME }}:dev diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c814dfb..51208e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,8 @@ jobs: prepare: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: + - uses: actions/checkout@v6 + with: ref: main - name: 加载版本号 run: | @@ -23,7 +23,7 @@ jobs: echo "VERSION file not found!" && exit 1 fi - name: 输出版本号 - run: | + run: | echo "Version: ${{ env.VERSION }}" - name: 预先创建release id: create_release @@ -40,17 +40,16 @@ jobs: build: runs-on: ubuntu-latest - needs: prepare # 确保这个作业在 prepare 作业完成后运行 + needs: prepare strategy: matrix: goos: [linux, darwin, freebsd] goarch: [amd64, arm64] env: OUTPUT_BINARY: ghproxy - GO_VERSION: 1.25 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 with: ref: main - name: 加载版本号 @@ -64,11 +63,11 @@ jobs: run: | sudo git clone https://github.com/WJQSERVER-STUDIO/GHProxy-Frontend.git pages sudo rm -rf pages/.git/ - + - name: 安装 Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod - name: 编译 env: GOOS: ${{ matrix.goos }} @@ -83,11 +82,11 @@ jobs: cp LICENSE ./ghproxyd/ tar -czf ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}}.tar.gz -C ghproxyd . - name: 上传Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ${{ env.OUTPUT_BINARY }}-${{matrix.goos}}-${{matrix.goarch}} path: | - ./${{ env.OUTPUT_BINARY }}* + ./${{ env.OUTPUT_BINARY }}* - name: 上传至Release id: create_release uses: ncipollo/release-action@v1 @@ -103,14 +102,14 @@ jobs: docker: runs-on: ubuntu-latest - needs: build # 确保这个作业在 build 作业完成后运行 + needs: build env: - IMAGE_NAME: wjqserver/ghproxy # 定义镜像名称变量 - DOCKERFILE: docker/dockerfile/release/Dockerfile # 定义 Dockerfile 路径变量 + IMAGE_NAME: wjqserver/ghproxy + DOCKERFILE: docker/dockerfile/release/Dockerfile steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: main - name: Load VERSION @@ -122,26 +121,26 @@ jobs: fi - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Login to Docker Hub - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: 构建镜像 - uses: docker/build-push-action@v6 + uses: docker/build-push-action@v7 with: file: ./${{ env.DOCKERFILE }} platforms: linux/amd64,linux/arm64 push: true - tags: | + tags: | ${{ env.IMAGE_NAME }}:${{ env.VERSION }} ${{ env.IMAGE_NAME }}:v4 ${{ env.IMAGE_NAME }}:latest wjqserver/ghproxy-touka:latest - wjqserver/ghproxy-touka:${{ env.VERSION }} \ No newline at end of file + wjqserver/ghproxy-touka:${{ env.VERSION }} diff --git a/go.mod b/go.mod index 6789d19..04c8a57 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( ) require ( - github.com/WJQSERVER-STUDIO/go-utils/iox v0.0.3 github.com/WJQSERVER-STUDIO/go-utils/limitreader v0.0.2 github.com/WJQSERVER/wanf v0.0.8 github.com/fenthope/bauth v0.0.1 @@ -25,6 +24,7 @@ require ( ) require ( + github.com/WJQSERVER-STUDIO/go-utils/iox v0.0.3 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect golang.org/x/text v0.36.0 // indirect )