From 5fea5fe71b6255741c70065efef96cd235db499b Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 13 Feb 2022 17:28:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=20Release=20workflow=20&=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=20Docker=20Images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 13 +- .../{release.yml => release-linux.yml} | 11 +- .github/workflows/release-macos.yml | 116 ++++++++++++++++++ share/const.go | 2 +- 4 files changed, 127 insertions(+), 15 deletions(-) rename .github/workflows/{release.yml => release-linux.yml} (91%) create mode 100644 .github/workflows/release-macos.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3927eef0..4c54152d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,14 +1,17 @@ -name: docker +name: Build and push docker images +# Only trigger, when the Release Linux workflow succeeded on: - push: - branches: [main] - paths: - - ".github/workflows/docker.yml" + workflow_run: + workflows: ["Release Linux"] + types: + - completed + env: VERSION: 0.9.0 jobs: build: + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release-linux.yml similarity index 91% rename from .github/workflows/release.yml rename to .github/workflows/release-linux.yml index 15ad1928..07085c0d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-linux.yml @@ -1,4 +1,4 @@ -name: Release +name: Release Linux on: push: @@ -11,11 +11,9 @@ jobs: strategy: matrix: go: [1.17] - platform: [ubuntu-latest, macos-11] - runs-on: ${{ matrix.platform }} + runs-on: "ubuntu-latest" steps: - name: Arm Build - if: matrix.platform == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi libncurses5-dev build-essential bison flex libssl-dev bc @@ -96,13 +94,8 @@ jobs: go get github.com/elazarl/go-bindata-assetfs/... - name: Make Artifacts Linux - if: matrix.platform == 'ubuntu-latest' run: | make artifacts-linux - - name: Make Artifacts MacOS - if: matrix.platform == 'macos-11' - run: | - make artifacts-macos - name: Configure COS For Silicon Valley env: diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml new file mode 100644 index 00000000..baa1e52e --- /dev/null +++ b/.github/workflows/release-macos.yml @@ -0,0 +1,116 @@ +name: Release MacOS + +on: + push: + branches: [main] + paths: + - "share/const.go" + +jobs: + release: + strategy: + matrix: + go: [1.17] + runs-on: "macos-11" + steps: + - name: Install coscmd + run: sudo pip3 install coscmd + + - name: Setup Cache + uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Checkout Kun + uses: actions/checkout@v2 + with: + repository: yaoapp/kun + path: kun + + - name: Checkout Xun + uses: actions/checkout@v2 + with: + repository: yaoapp/xun + path: xun + + - name: Checkout Gou + uses: actions/checkout@v2 + with: + repository: yaoapp/gou + path: gou + token: ${{ secrets.TOKEN }} + + - name: Checkout V8Go + uses: actions/checkout@v2 + with: + repository: rogchap/v8go + ref: 5e91d3d9dcabd2986f901b6b31590e49fc3c4dd8 + path: v8go + + - name: Checkout UI + uses: actions/checkout@v2 + with: + repository: yaoapp/xgen + path: ui + token: ${{ secrets.TOKEN }} + + - name: Move Kun, Xun, Gou, UI, V8Go + run: | + mv kun ../ + mv xun ../ + mv gou ../ + mv v8go ../ + mv ui ../ + ls -l . + ls -l ../ + + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Setup Go ${{ matrix.go }} + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + + - name: Setup Go Tools + run: | + if [[ "${GO111MODULE}" = "on" ]]; then go mod download; fi + if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi + if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi + go get github.com/go-bindata/go-bindata/... + go get github.com/elazarl/go-bindata-assetfs/... + + - name: Make Artifacts MacOS + run: | + make artifacts-macos + + - name: Configure COS For Silicon Valley + env: + SECRET_ID: ${{ secrets.COS_ID }} + SECRET_KEY: ${{ secrets.COS_KEY }} + BUCKET: release-sv-1252011659 + REGION: na-siliconvalley + run: | + coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION + + - name: Push To Silicon Valley + run: | + for file in ./dist/release/*; do coscmd upload $file /archives/; done; + + - name: Configure COS For Beijing + env: + SECRET_ID: ${{ secrets.COS_ID }} + SECRET_KEY: ${{ secrets.COS_KEY }} + BUCKET: release-bj-1252011659 + REGION: ap-beijing + run: | + coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION + + - name: Push To Beijing + run: | + for file in ./dist/release/*; do coscmd upload $file /archives/; done; diff --git a/share/const.go b/share/const.go index f08fff1a..34c85e45 100644 --- a/share/const.go +++ b/share/const.go @@ -4,7 +4,7 @@ package share // session -> freeport fix bug // 更新制品目录 -> ui/downloads // Arm64 制品 -> arm build test -// MacOS 制品 -> debug 18 +// MacOS 制品 -> debug 19 // VERSION 版本号 const VERSION = "0.9.1"