From a58ebd2c83710fd0a52b8d9abef21d2c025f3493 Mon Sep 17 00:00:00 2001 From: yisier <1340976576@qq.com> Date: Fri, 4 Nov 2022 16:59:34 +0800 Subject: [PATCH] action test --- .github/workflows/docker.yml | 55 ++++++ .github/workflows/pkg.yml | 91 ---------- .github/workflows/release.yml | 329 +++++++++++++++++----------------- 3 files changed, 220 insertions(+), 255 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..e67da59 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,55 @@ +name: Release + +on: +# workflow_dispatch: + release: + types: [published] +# branches: [ master ] + tags: [v*] + +jobs: + build_docker: + + runs-on: ubuntu-latest + steps: + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push nps + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile.nps + platforms: linux/amd64,linux/arm,linux/arm64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/nps:latest + ${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }} + - name: Build and push npc + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile.npc + platforms: linux/amd64,linux/arm,linux/arm64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/npc:latest + ${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/pkg.yml b/.github/workflows/pkg.yml index 233dae5..9a809c6 100644 --- a/.github/workflows/pkg.yml +++ b/.github/workflows/pkg.yml @@ -71,94 +71,3 @@ jobs: npc_sdk.tar.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build_android: - - runs-on: ubuntu-latest - steps: - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Build - run: | - chmod +x build.android.sh - docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk -e GOPROXY=direct fyneio/fyne-cross:android-latest /app/build.android.sh - - name: Upload - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - android_client.apk - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build_spk: - - runs-on: ubuntu-latest - steps: - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Build - run: | - git clone https://github.com/cnlh/spksrc.git ~/spksrc - mkdir ~/spksrc/nps && cp -rf ./* ~/spksrc/nps/ - docker run -id --name spksrc --env VERSION=${{ env.RELEASE_VERSION }} -e GOPROXY=direct -v ~/spksrc:/spksrc synocommunity/spksrc /bin/bash - docker exec spksrc /bin/bash -c 'cd /spksrc && make setup && cd /spksrc/spk/npc && make' - cp ~/spksrc/packages/npc_noarch-all_${{ env.RELEASE_VERSION }}-1.spk ./npc_syno.spk - - name: Upload - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - npc_syno.spk - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build_docker: - - runs-on: ubuntu-latest - steps: - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push nps - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile.nps - platforms: linux/amd64,linux/arm,linux/arm64 - push: true - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/nps:latest - ${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }} - - name: Build and push npc - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile.npc - platforms: linux/amd64,linux/arm,linux/arm64 - push: true - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/npc:latest - ${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63ddd35..f850632 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,164 +1,165 @@ -name: Release - -on: - workflow_dispatch: - release: - types: [published] - branches: [ master ] - -jobs: - - build_assets: - - runs-on: ubuntu-latest - steps: - - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: 1.15 - id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - name: Build - run: | - chmod +x build.assets.sh - ./build.assets.sh - - name: Upload - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - freebsd_386_client.tar.gz - freebsd_386_server.tar.gz - freebsd_amd64_client.tar.gz - freebsd_amd64_server.tar.gz - freebsd_arm_client.tar.gz - freebsd_arm_server.tar.gz - linux_386_client.tar.gz - linux_386_server.tar.gz - linux_amd64_client.tar.gz - linux_amd64_server.tar.gz - linux_arm64_client.tar.gz - linux_arm64_server.tar.gz - linux_arm_v5_client.tar.gz - linux_arm_v6_client.tar.gz - linux_arm_v7_client.tar.gz - linux_arm_v5_server.tar.gz - linux_arm_v6_server.tar.gz - linux_arm_v7_server.tar.gz - linux_mips64le_client.tar.gz - linux_mips64le_server.tar.gz - linux_mips64_client.tar.gz - linux_mips64_server.tar.gz - linux_mipsle_client.tar.gz - linux_mipsle_server.tar.gz - linux_mips_client.tar.gz - linux_mips_server.tar.gz - darwin_amd64_client.tar.gz - darwin_amd64_server.tar.gz - windows_386_client.tar.gz - windows_386_server.tar.gz - windows_amd64_client.tar.gz - windows_amd64_server.tar.gz - npc_sdk.tar.gz - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build_android: - - runs-on: ubuntu-latest - steps: - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Build - run: | - chmod +x build.android.sh - docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk -e GOPROXY=direct fyneio/fyne-cross:android-latest /app/build.android.sh - - name: Upload - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - android_client.apk - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build_spk: - - runs-on: ubuntu-latest - steps: - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Build - run: | - git clone https://github.com/cnlh/spksrc.git ~/spksrc - mkdir ~/spksrc/nps && cp -rf ./* ~/spksrc/nps/ - docker run -id --name spksrc --env VERSION=${{ env.RELEASE_VERSION }} -e GOPROXY=direct -v ~/spksrc:/spksrc synocommunity/spksrc /bin/bash - docker exec spksrc /bin/bash -c 'cd /spksrc && make setup && cd /spksrc/spk/npc && make' - cp ~/spksrc/packages/npc_noarch-all_${{ env.RELEASE_VERSION }}-1.spk ./npc_syno.spk - - name: Upload - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - npc_syno.spk - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build_docker: - - runs-on: ubuntu-latest - steps: - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push nps - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile.nps - platforms: linux/amd64,linux/arm,linux/arm64 - push: true - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/nps:latest - ${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }} - - name: Build and push npc - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile.npc - platforms: linux/amd64,linux/arm,linux/arm64 - push: true - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/npc:latest - ${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }} +#name: Release +# +#on: +## workflow_dispatch: +# release: +# types: [published] +## branches: [ master ] +# tags: [v*] +# +#jobs: +# +# build_assets: +# +# runs-on: ubuntu-latest +# steps: +# +# - name: Set up Go 1.x +# uses: actions/setup-go@v2 +# with: +# go-version: 1.15 +# id: go +# - name: Check out code into the Go module directory +# uses: actions/checkout@v2 +# - name: Get dependencies +# run: | +# go get -v -t -d ./... +# if [ -f Gopkg.toml ]; then +# curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh +# dep ensure +# fi +# - name: Build +# run: | +# chmod +x build.assets.sh +# ./build.assets.sh +# - name: Upload +# uses: softprops/action-gh-release@v1 +# if: startsWith(github.ref, 'refs/tags/') +# with: +# files: | +# freebsd_386_client.tar.gz +# freebsd_386_server.tar.gz +# freebsd_amd64_client.tar.gz +# freebsd_amd64_server.tar.gz +# freebsd_arm_client.tar.gz +# freebsd_arm_server.tar.gz +# linux_386_client.tar.gz +# linux_386_server.tar.gz +# linux_amd64_client.tar.gz +# linux_amd64_server.tar.gz +# linux_arm64_client.tar.gz +# linux_arm64_server.tar.gz +# linux_arm_v5_client.tar.gz +# linux_arm_v6_client.tar.gz +# linux_arm_v7_client.tar.gz +# linux_arm_v5_server.tar.gz +# linux_arm_v6_server.tar.gz +# linux_arm_v7_server.tar.gz +# linux_mips64le_client.tar.gz +# linux_mips64le_server.tar.gz +# linux_mips64_client.tar.gz +# linux_mips64_server.tar.gz +# linux_mipsle_client.tar.gz +# linux_mipsle_server.tar.gz +# linux_mips_client.tar.gz +# linux_mips_server.tar.gz +# darwin_amd64_client.tar.gz +# darwin_amd64_server.tar.gz +# windows_386_client.tar.gz +# windows_386_server.tar.gz +# windows_amd64_client.tar.gz +# windows_amd64_server.tar.gz +# npc_sdk.tar.gz +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# build_android: +# +# runs-on: ubuntu-latest +# steps: +# +# - name: Check out code into the Go module directory +# uses: actions/checkout@v2 +# - name: Build +# run: | +# chmod +x build.android.sh +# docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk -e GOPROXY=direct fyneio/fyne-cross:android-latest /app/build.android.sh +# - name: Upload +# uses: softprops/action-gh-release@v1 +# if: startsWith(github.ref, 'refs/tags/') +# with: +# files: | +# android_client.apk +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# build_spk: +# +# runs-on: ubuntu-latest +# steps: +# +# - name: Check out code into the Go module directory +# uses: actions/checkout@v2 +# - name: Set env +# run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV +# - name: Build +# run: | +# git clone https://github.com/cnlh/spksrc.git ~/spksrc +# mkdir ~/spksrc/nps && cp -rf ./* ~/spksrc/nps/ +# docker run -id --name spksrc --env VERSION=${{ env.RELEASE_VERSION }} -e GOPROXY=direct -v ~/spksrc:/spksrc synocommunity/spksrc /bin/bash +# docker exec spksrc /bin/bash -c 'cd /spksrc && make setup && cd /spksrc/spk/npc && make' +# cp ~/spksrc/packages/npc_noarch-all_${{ env.RELEASE_VERSION }}-1.spk ./npc_syno.spk +# - name: Upload +# uses: softprops/action-gh-release@v1 +# if: startsWith(github.ref, 'refs/tags/') +# with: +# files: | +# npc_syno.spk +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# build_docker: +# +# runs-on: ubuntu-latest +# steps: +# +# - name: Check out code into the Go module directory +# uses: actions/checkout@v2 +# - name: Set env +# run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v1 +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v1 +# - name: Cache Docker layers +# uses: actions/cache@v2 +# with: +# path: /tmp/.buildx-cache +# key: ${{ runner.os }}-buildx-${{ github.sha }} +# restore-keys: | +# ${{ runner.os }}-buildx- +# - name: Login to DockerHub +# uses: docker/login-action@v1 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# - name: Build and push nps +# uses: docker/build-push-action@v2 +# with: +# context: . +# file: ./Dockerfile.nps +# platforms: linux/amd64,linux/arm,linux/arm64 +# push: true +# tags: | +# ${{ secrets.DOCKERHUB_USERNAME }}/nps:latest +# ${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }} +# - name: Build and push npc +# uses: docker/build-push-action@v2 +# with: +# context: . +# file: ./Dockerfile.npc +# platforms: linux/amd64,linux/arm,linux/arm64 +# push: true +# tags: | +# ${{ secrets.DOCKERHUB_USERNAME }}/npc:latest +# ${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }}