From 11052d8f778431d05bbd3d529de2eb87adc6dd0a Mon Sep 17 00:00:00 2001 From: Skyxim Date: Tue, 25 Jan 2022 20:30:25 +0800 Subject: [PATCH] github action add build (cherry picked from commit bdec838673767977c14191861ac1b9a8291e2ffc) --- .github/workflows/build.yaml | 20 ++++++++++ .github/workflows/docker.yml | 76 ------------------------------------ Makefile | 6 ++- 3 files changed, 25 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..a81a20e9 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,20 @@ +name: Build All +on: + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.17 + - name: Check out code + uses: actions/checkout@v1 + - name: Build + run: make + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: bin/* + draft: true \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index f0ad1ea8..00000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Publish Docker Image -on: - push: - branches: - - dev - tags: - - '*' -jobs: - - build: - name: Build - runs-on: ubuntu-latest - steps: - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - with: - platforms: all - - - name: Set up docker buildx - id: buildx - uses: docker/setup-buildx-action@v1 - with: - version: latest - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Login to Github Package - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: Dreamacro - password: ${{ secrets.PACKAGE_TOKEN }} - - - name: Build dev branch and push - if: github.ref == 'refs/heads/dev' - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 - push: true - tags: 'dreamacro/clash:dev,ghcr.io/dreamacro/clash:dev' - - - name: Get all docker tags - if: startsWith(github.ref, 'refs/tags/') - uses: actions/github-script@v4 - id: tags - with: - script: | - const ref = `${context.payload.ref.replace(/\/?refs\/tags\//, '')}` - const tags = [ - 'dreamacro/clash:latest', - `dreamacro/clash:${ref}`, - 'ghcr.io/dreamacro/clash:latest', - `ghcr.io/dreamacro/clash:${ref}` - ] - return tags.join(',') - result-encoding: string - - - name: Build release and push - if: startsWith(github.ref, 'refs/tags/') - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 - push: true - tags: ${{steps.tags.outputs.result}} diff --git a/Makefile b/Makefile index f547164e..82c1f89c 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,11 @@ WINDOWS_ARCH_LIST = \ windows-arm32v7 -all: linux-arm64-AutoIptables linux-amd64-AutoIptables linux-arm64 linux-amd64 darwin-amd64 darwin-arm64 windows-amd64 windows-386 # Most used +all:linux-amd64-AutoIptables linux-amd64\ + linux-arm64 linux-arm64-AutoIptables linux-armv7\ + darwin-amd64 darwin-arm64\ + windows-amd64 windows-386 \ + linux-mips-hardfloat linux-mips-softfloat linux-mips64 linux-mips64le linux-mipsle-hardfloat linux-mipsle-softfloat# Most used docker: $(GOBUILD) -o $(BINDIR)/$(NAME)-$@