Skip to content

Build v1.3.2 by @thun888 #48

Build v1.3.2 by @thun888

Build v1.3.2 by @thun888 #48

Workflow file for this run

name: Build and Release
run-name: Build ${{ github.event.inputs.version }} by @${{ github.actor }}
permissions: write-all
on:
workflow_dispatch:
inputs:
version:
description: '版本号'
required: true
jobs:
build_win:
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
run: bash build.sh ${{ github.event.inputs.version }} win
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: mirouter-ui-win
path: ./build/**
build_linux:
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
run: bash build.sh ${{ github.event.inputs.version }} linux
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: mirouter-ui-linux
path: ./build/**
build_darwin:
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
run: bash build.sh ${{ github.event.inputs.version }} darwin
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: mirouter-ui-darwin
path: ./build/**
post_release:
runs-on: ubuntu-20.04
needs: [build_win, build_linux, build_darwin]
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: mirouter-ui-win
path: ./build
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: mirouter-ui-linux
path: ./build
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: mirouter-ui-darwin
path: ./build
- name: Upload Release Assets
uses: ncipollo/release-action@v1
with:
artifacts: "build/*"
token: ${{ secrets.TOKEN }}
tag: ${{ github.event.inputs.version }}
name: Release ${{ github.event.inputs.version }}
draft: true
# 安装 rclone
- 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/${{ github.event.inputs.version }}
rclone sync ./build one:/share/Mirouter-ui/${{ github.event.inputs.version }}
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:latest
build-args: |
VERSION=${{ github.event.inputs.version }}