From ae79fcbfd5d122da3f7b0720d1f7848fe9d85ba1 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 12 Jun 2023 20:07:51 +0800 Subject: [PATCH] [add] v0.10.3 release workflow --- .github/workflows/v0.10.3-release-docker.yml | 84 +++++++++++ .github/workflows/v0.10.3-release-linux.yml | 143 +++++++++++++++++++ .github/workflows/v0.10.3-release-macos.yml | 139 ++++++++++++++++++ 3 files changed, 366 insertions(+) create mode 100644 .github/workflows/v0.10.3-release-docker.yml create mode 100644 .github/workflows/v0.10.3-release-linux.yml create mode 100644 .github/workflows/v0.10.3-release-macos.yml diff --git a/.github/workflows/v0.10.3-release-docker.yml b/.github/workflows/v0.10.3-release-docker.yml new file mode 100644 index 00000000..ac33f139 --- /dev/null +++ b/.github/workflows/v0.10.3-release-docker.yml @@ -0,0 +1,84 @@ +name: Release Yao v0.10.3 Docker Image + +on: + # push: + # branches: [main] + # paths: + # - ".github/workflows/docker.yml" + workflow_run: + workflows: ["Release Yao v0.10.3 Linux"] + types: + - completed + +env: + VERSION: 0.9.0 +jobs: + build: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get Version + run: | + echo VERSION=$(cat share/const.go |grep 'const VERSION' | awk '{print $4}' | sed "s/\"//g") >> $GITHUB_ENV + + - name: Check Version + run: echo $VERSION + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build Development + uses: docker/build-push-action@v2 + with: + context: ./docker/development + platforms: linux/amd64 + build-args: | + VERSION=${{ env.VERSION }} + ARCH=amd64 + push: true + tags: yaoapp/yao:${{ env.VERSION }}-amd64-dev + + - name: Build Development Arm64 + uses: docker/build-push-action@v2 + with: + context: ./docker/development + platforms: linux/arm64 + build-args: | + VERSION=${{ env.VERSION }} + ARCH=arm64 + push: true + tags: yaoapp/yao:${{ env.VERSION }}-arm64-dev + + - name: Build Production + uses: docker/build-push-action@v2 + with: + context: ./docker/production + platforms: linux/amd64 + build-args: | + VERSION=${{ env.VERSION }} + ARCH=amd64 + push: true + tags: yaoapp/yao:${{ env.VERSION }}-amd64 + + - name: Build Production Arm64 + uses: docker/build-push-action@v2 + with: + context: ./docker/production + platforms: linux/arm64 + build-args: | + VERSION=${{ env.VERSION }} + ARCH=arm64 + push: true + tags: yaoapp/yao:${{ env.VERSION }}-arm64 diff --git a/.github/workflows/v0.10.3-release-linux.yml b/.github/workflows/v0.10.3-release-linux.yml new file mode 100644 index 00000000..46b3f35d --- /dev/null +++ b/.github/workflows/v0.10.3-release-linux.yml @@ -0,0 +1,143 @@ +name: Release Yao v0.10.3 Linux + +on: + workflow_dispatch: + inputs: + tags: + description: "Version tags" + +jobs: + build: + strategy: + matrix: + go: [1.19.2] + runs-on: "ubuntu-20.04" + steps: + - name: Arm Build + 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 + sudo apt-get install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi + sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf + sudo apt-get install -y g++-aarch64-linux-gnu crossbuild-essential-arm64 + + - name: Install coscmd + run: sudo pip3 install coscmd + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install pnpm + run: npm install -g pnpm + + - name: Setup Cache + uses: actions/cache@v3 + 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@v3 + with: + repository: yaoapp/kun + path: kun + + - name: Checkout Xun + uses: actions/checkout@v3 + with: + repository: yaoapp/xun + path: xun + + - name: Checkout Gou + uses: actions/checkout@v3 + with: + repository: yaoapp/gou + path: gou + + - name: Checkout V8Go + uses: actions/checkout@v3 + with: + repository: yaoapp/v8go + path: v8go + + - name: Checkout XGen v1.0 + uses: actions/checkout@v3 + with: + repository: yaoapp/xgen + path: xgen-v1.0 + + - name: Checkout Yao-Init + uses: actions/checkout@v3 + with: + repository: yaoapp/yao-init + path: yao-init + + - name: Move Kun, Xun, Gou, UI, V8Go + run: | + mv kun ../ + mv xun ../ + mv gou ../ + mv v8go ../ + mv xgen-v1.0 ../ + mv yao-init ../ + ls -l . + ls -l ../ + + - name: Checkout Code + uses: actions/checkout@v3 + with: + ref: 9792f5f12245948e86b43091ede70b1be1c68f4a + + - name: Setup Go ${{ matrix.go }} + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + + - name: Setup Go Tools + run: | + make tools + + - name: Make Artifacts Linux + run: | + make artifacts-linux + mv dist/release/yao-0.10.3-dev-linux-arm64 dist/release/yao-0.10.3-linux-arm64 + mv dist/release/yao-0.10.3-dev-linux-amd64 dist/release/yao-0.10.3-linux-amd64 + + - 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: Archive production artifacts + uses: actions/upload-artifact@v3 + with: + name: yao-linux + path: | + dist/release/* + + # - 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/.github/workflows/v0.10.3-release-macos.yml b/.github/workflows/v0.10.3-release-macos.yml new file mode 100644 index 00000000..31682198 --- /dev/null +++ b/.github/workflows/v0.10.3-release-macos.yml @@ -0,0 +1,139 @@ +name: Release Yao v0.10.3 MacOS + +on: + workflow_dispatch: + inputs: + tags: + description: "Version tags" +jobs: + build: + strategy: + matrix: + go: [1.19.2] + runs-on: "macos-12" + steps: + - name: Install coscmd + run: | + sudo /Library/Frameworks/Python.framework/Versions/3.11/bin/python -m pip install --upgrade pip + sudo pip3 install coscmd + echo "/Library/Frameworks/Python.framework/Versions/3.11/bin" >> $GITHUB_PATH + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install pnpm + run: npm install -g pnpm + + - name: Setup Cache + uses: actions/cache@v3 + 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@v3 + with: + repository: yaoapp/kun + path: kun + + - name: Checkout Xun + uses: actions/checkout@v3 + with: + repository: yaoapp/xun + path: xun + + - name: Checkout Gou + uses: actions/checkout@v3 + with: + repository: yaoapp/gou + path: gou + + - name: Checkout V8Go + uses: actions/checkout@v3 + with: + repository: yaoapp/v8go + path: v8go + + - name: Checkout XGen v1.0 + uses: actions/checkout@v3 + with: + repository: yaoapp/xgen + path: xgen-v1.0 + + - name: Checkout Yao-Init + uses: actions/checkout@v3 + with: + repository: yaoapp/yao-init + path: yao-init + + - name: Move Kun, Xun, Gou, UI, V8Go + run: | + mv kun ../ + mv xun ../ + mv gou ../ + mv v8go ../ + mv xgen-v1.0 ../ + mv yao-init ../ + rm -f ../xgen-v1.0/packages/setup/vite.config.ts.* + ls -l . + ls -l ../ + ls -l ../xgen-v1.0/packages/setup/ + + - name: Checkout Code + uses: actions/checkout@v3 + with: + ref: 9792f5f12245948e86b43091ede70b1be1c68f4a + + - name: Setup Go ${{ matrix.go }} + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + + - name: Setup Go Tools + run: | + make tools + + - name: Make Artifacts MacOS + run: | + make artifacts-macos + mv dist/release/yao-0.10.3-dev-darwin-arm64 dist/release/yao-0.10.3-darwin-arm64 + mv dist/release/yao-0.10.3-dev-darwin-amd64 dist/release/yao-0.10.3-darwin-amd64 + + - 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: Archive production artifacts + uses: actions/upload-artifact@v3 + with: + name: yao-macos + path: | + dist/release/* + + # - 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;