From e2c56a10074dddd3920cf00160d3473a9b9eea44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=AB=AD=E5=8A=9B?= Date: Sun, 8 Dec 2024 11:41:31 +0800 Subject: [PATCH] update workflow --- .github/workflows/build_new_lang.yml | 2 +- .github/workflows/node-prerelease.js.yml | 2 +- .github/workflows/push_test_server.yml | 123 ++++++++++++----------- 3 files changed, 66 insertions(+), 61 deletions(-) diff --git a/.github/workflows/build_new_lang.yml b/.github/workflows/build_new_lang.yml index 4bb5abd9..d16030db 100644 --- a/.github/workflows/build_new_lang.yml +++ b/.github/workflows/build_new_lang.yml @@ -17,7 +17,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "npm" + cache: "pnpm" - name: Install pnpm uses: pnpm/action-setup@v2 diff --git a/.github/workflows/node-prerelease.js.yml b/.github/workflows/node-prerelease.js.yml index dccd9500..69d6f5cb 100644 --- a/.github/workflows/node-prerelease.js.yml +++ b/.github/workflows/node-prerelease.js.yml @@ -27,7 +27,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: "npm" + cache: "pnpm" - name: "缓存 Cache" uses: actions/cache@v3 id: cache-dependencies diff --git a/.github/workflows/push_test_server.yml b/.github/workflows/push_test_server.yml index 157d9819..89acc13a 100644 --- a/.github/workflows/push_test_server.yml +++ b/.github/workflows/push_test_server.yml @@ -12,76 +12,81 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [ 16.x ] + node-version: [18.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v3 - - name: '使用 Use Node.js ${{ matrix.node-version }}' - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - name: '缓存 Cache' - uses: actions/cache@v3 - id: cache-dependencies - with: - path: node_modules - key: ${{runner.OS}}-${{hashFiles('**/yarn.lock')}} + - uses: actions/checkout@v3 + - name: "使用 Use Node.js ${{ matrix.node-version }}" + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + - name: "缓存 Cache" + uses: actions/cache@v3 + id: cache-dependencies + with: + path: node_modules + key: ${{runner.OS}}-${{hashFiles('**/yarn.lock')}} - - name: install git - run: sudo apt install --yes git + - name: install git + run: sudo apt install --yes git - - name: git global - run: sudo git config --global --add safe.directory '*' + - name: git global + run: sudo git config --global --add safe.directory '*' - - name: Fetch all tags - run: sudo git fetch --force --tags + - name: Fetch all tags + run: sudo git fetch --force --tags - - name: Get version - id: get_version - # run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - # run: echo "VERSION=$(git describe --abbrev=0 --tags | awk -F- '{print $1}')" >> $GITHUB_ENV - run: echo "VERSION=v00.00.00" >> $GITHUB_ENV + - name: Get version + id: get_version + # run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + # run: echo "VERSION=$(git describe --abbrev=0 --tags | awk -F- '{print $1}')" >> $GITHUB_ENV + run: echo "VERSION=v00.00.00" >> $GITHUB_ENV - - name: show version - id: show_version - run: echo ${{ env.VERSION }} - # run: echo ${{ steps.get_version.outputs.VERSION }} + - name: show version + id: show_version + run: echo ${{ env.VERSION }} + # run: echo ${{ steps.get_version.outputs.VERSION }} - - run: yarn install - - run: yarn build - - run: | - tar -zcvf linux-all-casaos-${{ env.VERSION }}.tar.gz build - ls + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9.12.2 + run_install: false - - name: install sshpass - run: sudo apt install sshpass --yes + - run: pnpm install + - run: pnpm build + - run: | + tar -zcvf linux-all-casaos-${{ env.VERSION }}.tar.gz build + ls + - name: install sshpass + run: sudo apt install sshpass --yes - - name: ZeroTier - uses: zerotier/github-action@v1.0.1 - with: - network_id: ${{ secrets.ZEROTIER_NETWORK_ID }} - auth_token: ${{ secrets.ZEROTIER_CENTRAL_TOKEN }} + - name: ZeroTier + uses: zerotier/github-action@v1.0.1 + with: + network_id: ${{ secrets.ZEROTIER_NETWORK_ID }} + auth_token: ${{ secrets.ZEROTIER_CENTRAL_TOKEN }} - - name: ping hostname - shell: bash - run: | - count=10 - while ! ping -c 1 10.147.18.11 ; do - echo "waiting..." ; - sleep 1 ; - let count=count-1 - done - echo "ping success" + - name: ping hostname + shell: bash + run: | + count=10 + while ! ping -c 1 10.147.18.11 ; do + echo "waiting..." ; + sleep 1 ; + let count=count-1 + done + echo "ping success" - - name: copy tar to target hostname - shell: bash - run: | - sshpass -p "${{ secrets.ssh_password }}" scp -r -o StrictHostKeyChecking=no -P 22 ./linux-all-casaos-v00.00.00.tar.gz root@10.147.18.11:/var/www/download - echo "ping success" - - name: Error Handling - if: ${{ failure() }} - run: | - curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"CasaOS-UI push error"}}' ${{ secrets.SSH_ROBOT_URL }} + - name: copy tar to target hostname + shell: bash + run: | + sshpass -p "${{ secrets.ssh_password }}" scp -r -o StrictHostKeyChecking=no -P 22 ./linux-all-casaos-v00.00.00.tar.gz root@10.147.18.11:/var/www/download + echo "ping success" + - name: Error Handling + if: ${{ failure() }} + run: | + curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"CasaOS-UI push error"}}' ${{ secrets.SSH_ROBOT_URL }}