2021-09-29 09:33:58 +00:00
|
|
|
# This is a basic workflow to help you get started with Actions
|
|
|
|
|
|
|
|
name: Build CasaOS
|
|
|
|
|
2021-09-30 07:10:41 +00:00
|
|
|
on:
|
2021-09-30 07:22:05 +00:00
|
|
|
repository_dispatch:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
ssh:
|
|
|
|
description: 'SSH connection to Actions'
|
|
|
|
required: false
|
|
|
|
default: 'false'
|
|
|
|
|
|
|
|
#on:
|
|
|
|
# push:
|
|
|
|
# branches:
|
|
|
|
# - 'main'
|
|
|
|
# tags:
|
|
|
|
# - 'v*'
|
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
|
2021-12-30 10:44:07 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-09-29 09:33:58 +00:00
|
|
|
steps:
|
2021-09-30 06:43:45 +00:00
|
|
|
|
2021-09-30 07:10:41 +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-30 08:51:20 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
submodules: true
|
|
|
|
# - 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
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-30 07:52:56 +00:00
|
|
|
|
2021-09-30 06:43:45 +00:00
|
|
|
|
2021-09-30 08:51:20 +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
|
2022-01-04 06:51:09 +00:00
|
|
|
|
2021-09-30 07:24:18 +00:00
|
|
|
|
|
|
|
- name: Set enviroment for github-release
|
|
|
|
run: |
|
2021-09-30 08:51:20 +00:00
|
|
|
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-30 07:24:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-29 09:33:58 +00:00
|
|
|
- name: Use Node.js
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
2021-12-30 10:44:07 +00:00
|
|
|
|
2021-09-30 08:55:00 +00:00
|
|
|
- name: Build frontend with nodejs and yarn
|
|
|
|
run: |
|
2021-09-30 09:00:55 +00:00
|
|
|
cd UI
|
2021-09-30 08:55:00 +00:00
|
|
|
ls
|
|
|
|
yarn install
|
|
|
|
yarn build
|
2021-09-30 06:43:45 +00:00
|
|
|
|
2021-09-30 07:52:56 +00:00
|
|
|
- name: list work
|
2021-09-30 08:06:56 +00:00
|
|
|
run: pwd
|
2021-09-30 07:52:56 +00:00
|
|
|
|
2021-09-30 08:55:00 +00:00
|
|
|
- name: Build with xgo
|
|
|
|
uses: crazy-max/ghaction-xgo@v1
|
|
|
|
with:
|
2022-01-04 08:22:38 +00:00
|
|
|
xgo_version: v0.7.5
|
2021-09-30 08:55:00 +00:00
|
|
|
go_version: ${{ matrix.go_version }}
|
|
|
|
dest: build
|
|
|
|
prefix: casa
|
2021-10-15 03:43:41 +00:00
|
|
|
targets: linux/amd64,linux/arm64,linux/arm-7
|
2021-09-30 08:55:00 +00:00
|
|
|
v: true
|
|
|
|
x: false
|
|
|
|
race: false
|
2022-01-04 08:22:38 +00:00
|
|
|
ldflags: -s -w
|
2021-09-30 08:55:00 +00:00
|
|
|
buildmode: default
|
2021-09-30 08:57:10 +00:00
|
|
|
#
|
|
|
|
# - name: List Files
|
|
|
|
# run: |
|
|
|
|
# ls
|
|
|
|
# mkdir 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: |
|
|
|
|
wget $PACK_SH_URL
|
|
|
|
chmod +x $PACK_SH
|
2021-09-30 08:51:20 +00:00
|
|
|
./$PACK_SH
|
2021-09-29 09:33:58 +00:00
|
|
|
echo "::set-output name=status::success"
|
2021-09-30 08:13:14 +00:00
|
|
|
- name: list work
|
|
|
|
run: ls
|
2021-09-30 07:34:02 +00:00
|
|
|
|
2021-09-30 08:55:00 +00:00
|
|
|
|
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 }}
|
2021-09-30 07:52:56 +00:00
|
|
|
files: >
|
2021-09-30 08:51:20 +00:00
|
|
|
linux-amd64-casaos.tar.gz
|
|
|
|
linux-arm64-casaos.tar.gz
|
2021-10-15 11:48:38 +00:00
|
|
|
linux-arm-7-casaos.tar.gz
|
2021-09-30 06:43:45 +00:00
|
|
|
tag: v${{ env.VERSION }}
|
|
|
|
body: >
|
|
|
|
${{ env.BODY }}
|
|
|
|
name: v${{ env.VERSION }}
|
|
|
|
gzip: false
|
|
|
|
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
|