Build v1.1.8 by @thun888 #31
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 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-latest | |
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-latest | |
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-latest | |
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-latest | |
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: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
release_name: Release ${{ github.event.inputs.version }} | |
draft: true | |
prerelease: false | |
- name: Upload Release Assets | |
run: | | |
for file in ./build/*; do | |
if [ -f "$file" ]; then | |
echo "Uploading $file" | |
curl \ | |
-H "Authorization: token ${{ secrets.TOKEN }}" \ | |
-H "Content-Type: $(file -b --mime-type $file)" \ | |
--data-binary @"$file" \ | |
"${{ steps.create_release.outputs.upload_url }}=$(basename $file)" | |
fi | |
done | |
builddocker: | |
runs-on: ubuntu-latest | |
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 |