From 3fa09dad8e44b99eeaaed36b3460d580ab28d169 Mon Sep 17 00:00:00 2001 From: link Date: Wed, 29 Sep 2021 17:33:58 +0800 Subject: [PATCH] add workflows --- .github/workflows/casa.yml | 102 +++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/casa.yml diff --git a/.github/workflows/casa.yml b/.github/workflows/casa.yml new file mode 100644 index 0000000..ed2a9ec --- /dev/null +++ b/.github/workflows/casa.yml @@ -0,0 +1,102 @@ +# This is a basic workflow to help you get started with Actions + +name: Build CasaOS + +on: + release: + types: + - created + +env: + REPO_URL: https://github.com/IceWhaleTech/CasaOS.git + REPO_BRANCH: main + PACK_SH_URL: https://raw.githubusercontent.com/jerrykuku/actions-casa/main/pack.sh + PACK_SH: pack.sh + TZ: Asia/Shanghai + +jobs: + xgo: + strategy: + fail-fast: false + matrix: + go_version: + - 1.17.1 + runs-on: ubuntu-latest + steps: + + - name: Get release + id: get_release + uses: bruceadams/get-release@v1.2.3 + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Initialization environment + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo timedatectl set-timezone "$TZ" + sudo mkdir -p /workdir + sudo chown $USER:$GROUPS /workdir + + - name: Clone source code + working-directory: /workdir + run: | + df -hT $PWD + git clone $REPO_URL -b $REPO_BRANCH --recursive casa + ln -sf /workdir/casa $GITHUB_WORKSPACE/casa + ls + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Build frontend with nodejs and yarn + run: | + cd casa/UI + ls + yarn install + yarn build + + - name: Build with xgo + uses: crazy-max/ghaction-xgo@v1 + with: + working_dir: /workdir/casa + xgo_version: latest + go_version: ${{ matrix.go_version }} + dest: build + prefix: casa + targets: linux/amd64,linux/arm64 + v: true + x: false + race: false + ldflags: -s -w + buildmode: default + + - name: List Files + run: | + ls + cd casa/build + ls + echo "::set-output name=status::success" + + - name: Pack builds + run: | + cd /workdir + wget $PACK_SH_URL + chmod +x $PACK_SH + $GITHUB_WORKSPACE/$PACK_SH + echo "::set-output name=status::success" + + - name: Upload linux-amd64-casaos.tar.gz + id: upload_assets_amd64 + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + asset_path: /workdir/casa/upload/linux-amd64-casaos.tar.gz + + - name: Upload linux-arm64-casaos.tar.gz + id: upload_assets_arm64 + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + asset_path: /workdir/casa/upload/linux-arm64-casaos.tar.gz