Skip to content

Build Mihomo

Build Mihomo #657

Workflow file for this run

name: Build Mihomo
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *" # Runs at 00:00
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Install Prettier
run: npm install --global prettier
- name: Install Mihomo
run: |-
gh release --repo 'MetaCubeX/mihomo' download --pattern 'mihomo-linux-amd64-v3-go123-v*.gz'
gunzip mihomo-linux-amd64-v3-go123-v*.gz
install -D mihomo-* "$HOME/.local/bin/mihomo"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
env:
GH_TOKEN: ${{ github.token }}
- name: Test Mihomo
run: mihomo -v
- name: Install mise
uses: jdx/mise-action@dad1bfd3df957f44999b559dd69dc1671cb4e9ea # v4
- name: Setup uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
activate-environment: true
- name: Install dependencies
run: uv sync --active --frozen --all-packages
- name: Build
run: mise run build
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: mihomo
path: dist
deploy:
name: Deploy
permissions:
contents: write
needs:
- build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Download Artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: mihomo
path: dist
- name: Deploy
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4
with:
folder: dist
branch: mihomo
single-commit: true
# TODO: deploy docs to GitHub Pages
# docs:
# name: Docs
# permissions:
# contents: write
# pages: write
# needs:
# - deploy
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
# with:
# fetch-depth: 0
# - name: Setup Python
# uses: liblaf/actions/setup-python@f6cf271d2b7400fb019d0366c1a389ab23239730 # dist
# - name: Deploy
# run: mkdocs gh-deploy --force --no-history
# - name: Setup GitHub Pages
# uses: liblaf/actions/setup-pages@f6cf271d2b7400fb019d0366c1a389ab23239730 # dist
# with:
# token: ${{ secrets.GH_PAT || github.token }}
# continue-on-error: true