CasaOS/.github/workflows/casa.yml

131 lines
3.5 KiB
YAML
Raw Normal View History

2021-09-29 09:33:58 +00:00
# This is a basic workflow to help you get started with Actions
name: Build CasaOS
on:
2021-09-30 06:43:45 +00:00
repository_dispatch:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
2021-09-29 09:33:58 +00:00
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:
2021-09-30 06:43:45 +00:00
2021-09-29 09:33:58 +00:00
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ github.token }}
2021-09-30 06:43:45 +00:00
2021-09-29 09:33:58 +00:00
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
2021-09-30 06:43:45 +00:00
- name: Set enviroment for github-release
run: |
echo "VERSION=$(cat types/system.go | grep CURRENTVERSION | awk '$2 == "CURRENTVERSION"{print $4}' | sed 's/"//g')" >>$GITHUB_ENV
echo "BODY=$(cat types/system.go | grep BODY | awk -F= '{print $2}' | sed 's/"//g')" >>$GITHUB_ENV
2021-09-29 09:33:58 +00:00
- 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
2021-09-30 06:43:45 +00:00
2021-09-29 09:33:58 +00:00
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
2021-09-30 06:43:45 +00:00
2021-09-29 09:33:58 +00:00
- name: Build frontend with nodejs and yarn
run: |
cd casa/UI
ls
yarn install
yarn build
2021-09-30 06:43:45 +00:00
2021-09-29 09:33:58 +00:00
- 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
2021-09-30 06:43:45 +00:00
2021-09-29 09:33:58 +00:00
- name: List Files
run: |
ls
cd casa/build
ls
echo "::set-output name=status::success"
2021-09-30 06:43:45 +00:00
2021-09-29 09:33:58 +00:00
- name: Pack builds
run: |
cd /workdir
wget $PACK_SH_URL
chmod +x $PACK_SH
2021-09-29 10:02:22 +00:00
./$PACK_SH
2021-09-29 09:33:58 +00:00
echo "::set-output name=status::success"
2021-09-30 06:43:45 +00:00
- name: Update release
uses: meeDamian/github-release@2.0
2021-09-29 09:33:58 +00:00
with:
2021-09-30 06:43:45 +00:00
token: ${{ secrets.GITHUB_TOKEN }}
files: >
/workdir/casa/upload/linux-amd64-casaos.tar.gz
/workdir/casa/upload/linux-arm64-casaos.tar.gz
tag: v${{ env.VERSION }}
body: >
${{ env.BODY }}
name: v${{ env.VERSION }}
gzip: false
commitish: master
allow_override: false
prerelease: true
# - 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