From 4999936909ec258b43310e02db1682a4cb3d3664 Mon Sep 17 00:00:00 2001 From: Nite07 Date: Thu, 25 Apr 2024 22:23:12 +0800 Subject: [PATCH] :fire: Deprecate Woodpecker CI in favor of GitHub Actions --- .github/workflows/docker.yml | 53 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 28 ++++++++++++++++++ .goreleaser.yaml | 2 ++ .woodpecker/docker.yml | 21 -------------- .woodpecker/release.yml | 20 ------------- 5 files changed, 83 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .woodpecker/docker.yml delete mode 100644 .woodpecker/release.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..5c73662 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,53 @@ +name: docker + +on: + push: + tags: + - "v*" + +jobs: + prepare-and-build: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + nite07/sub2sing-box + ghcr.io/nitezs/sub2sing-box + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + build-args: | + "version=${{ github.ref_name }}" + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..aa60754 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2916189..ea2d996 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -25,3 +25,5 @@ archives: - LICENSE - README.md - templates +release: + draft: true diff --git a/.woodpecker/docker.yml b/.woodpecker/docker.yml deleted file mode 100644 index d932f24..0000000 --- a/.woodpecker/docker.yml +++ /dev/null @@ -1,21 +0,0 @@ -when: - - event: tag - ref: refs/tags/v* - -steps: - - name: prepare-tags - image: bash - commands: - - | - echo "${CI_COMMIT_TAG##v}" > .tags - if ! echo "${CI_COMMIT_TAG}" | grep -Eq "beta|alpha"; then - echo "latest" > .tags - fi - - name: build - image: woodpeckerci/plugin-docker-buildx - settings: - platforms: linux/amd64 - repo: nite07/sub2sing-box - username: nite07 - password: - from_secret: docker_password diff --git a/.woodpecker/release.yml b/.woodpecker/release.yml deleted file mode 100644 index 23878ba..0000000 --- a/.woodpecker/release.yml +++ /dev/null @@ -1,20 +0,0 @@ -when: - - event: tag - ref: refs/tags/v* - -steps: - - name: build - image: goreleaser/goreleaser:latest - commands: - - goreleaser release --clean --skip publish - - mkdir release - - mv dist/*.tar.gz release/ - - mv dist/*.zip release/ - - name: release - image: woodpeckerci/plugin-gitea-release - settings: - files: release/* - api_key: - from_secret: forgejo_token - base-url: https://git.nite07.com - draft: true