Build DEV version #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build DEV version | |
run-name: Build DEV version | |
permissions: write-all | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Install UPX | |
run: sudo apt-get install upx | |
- name: download modules | |
run: go mod download | |
- name: Run build script | |
# 传入commit sha | |
run: bash build.sh ${{ github.sha }} | |
# 安装 rclone | |
# dev版本不另外发release | |
- name: Install rclone | |
run: | | |
cd ~ | |
curl https://rclone.org/install.sh | sudo bash | |
# 配置 rclone | |
- name: Configure rclone | |
run: | | |
mkdir -p ~/.config/rclone | |
cat > ~/.config/rclone/rclone.conf << EOF | |
${{ secrets.RCLONECONFIG }} | |
EOF | |
- name: Sync to OneDrive | |
run: | | |
sudo timedatectl set-timezone "Asia/Shanghai" | |
rclone mkdir one:/share/Mirouter-ui/dev/${{ github.sha }} | |
rclone sync ./build one:/share/Mirouter-ui/dev/${{ github.sha }} | |
builddocker: | |
runs-on: ubuntu-20.04 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 | |
push: true | |
tags: thun888/mirouter-ui:dev | |
build-args: | | |
VERSION=${{ github.sha }} |