build.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. name: Build
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: "Tag version to release"
  7. required: true
  8. push:
  9. paths-ignore:
  10. - "docs/**"
  11. - "README.md"
  12. - ".github/ISSUE_TEMPLATE/**"
  13. branches:
  14. - Alpha
  15. tags:
  16. - "v*"
  17. pull_request_target:
  18. branches:
  19. - Alpha
  20. concurrency:
  21. group: "${{ github.workflow }}-${{ github.ref }}"
  22. cancel-in-progress: true
  23. env:
  24. REGISTRY: docker.io
  25. jobs:
  26. build:
  27. runs-on: ubuntu-latest
  28. strategy:
  29. matrix:
  30. jobs:
  31. - { goos: darwin, goarch: arm64, output: arm64 }
  32. - { goos: darwin, goarch: amd64, goamd64: v1, output: amd64-compatible }
  33. - { goos: darwin, goarch: amd64, goamd64: v3, output: amd64 }
  34. - { goos: linux, goarch: '386', output: '386' }
  35. - { goos: linux, goarch: amd64, goamd64: v1, output: amd64-compatible, test: test }
  36. - { goos: linux, goarch: amd64, goamd64: v3, output: amd64 }
  37. - { goos: linux, goarch: arm64, output: arm64 }
  38. - { goos: linux, goarch: arm, goarm: '5', output: armv5 }
  39. - { goos: linux, goarch: arm, goarm: '6', output: armv6 }
  40. - { goos: linux, goarch: arm, goarm: '7', output: armv7 }
  41. - { goos: linux, goarch: mips, mips: hardfloat, output: mips-hardfloat }
  42. - { goos: linux, goarch: mips, mips: softfloat, output: mips-softfloat }
  43. - { goos: linux, goarch: mipsle, mips: hardfloat, output: mipsle-hardfloat }
  44. - { goos: linux, goarch: mipsle, mips: softfloat, output: mipsle-softfloat }
  45. - { goos: linux, goarch: mips64, output: mips64 }
  46. - { goos: linux, goarch: mips64le, output: mips64le }
  47. - { goos: linux, goarch: loong64, output: loong64-abi1, abi: '1' }
  48. - { goos: linux, goarch: loong64, output: loong64-abi2, abi: '2' }
  49. - { goos: linux, goarch: riscv64, output: riscv64 }
  50. - { goos: linux, goarch: s390x, output: s390x }
  51. - { goos: windows, goarch: '386', output: '386' }
  52. - { goos: windows, goarch: amd64, goamd64: v1, output: amd64-compatible }
  53. - { goos: windows, goarch: amd64, goamd64: v3, output: amd64 }
  54. - { goos: windows, goarch: arm, goarm: '7', output: armv7 }
  55. - { goos: windows, goarch: arm64, output: arm64 }
  56. - { goos: freebsd, goarch: '386', output: '386' }
  57. - { goos: freebsd, goarch: amd64, goamd64: v1, output: amd64-compatible }
  58. - { goos: freebsd, goarch: amd64, goamd64: v3, output: amd64 }
  59. - { goos: freebsd, goarch: arm64, output: arm64 }
  60. - { goos: android, goarch: '386', ndk: i686-linux-android34, output: '386' }
  61. - { goos: android, goarch: amd64, ndk: x86_64-linux-android34, output: amd64 }
  62. - { goos: android, goarch: arm, ndk: armv7a-linux-androideabi34, output: armv7 }
  63. - { goos: android, goarch: arm64, ndk: aarch64-linux-android34, output: arm64-v8 }
  64. # Go 1.21 can revert commit `9e4385` to work on Windows 7
  65. # https://github.com/golang/go/issues/64622#issuecomment-1847475161
  66. # (OR we can just use golang1.21.4 which unneeded any patch)
  67. - { goos: windows, goarch: '386', output: '386-go121', goversion: '1.21' }
  68. - { goos: windows, goarch: amd64, goamd64: v1, output: amd64-compatible-go121, goversion: '1.21' }
  69. - { goos: windows, goarch: amd64, goamd64: v3, output: amd64-go121, goversion: '1.21' }
  70. # Go 1.20 is the last release that will run on any release of Windows 7, 8, Server 2008 and Server 2012. Go 1.21 will require at least Windows 10 or Server 2016.
  71. - { goos: windows, goarch: '386', output: '386-go120', goversion: '1.20' }
  72. - { goos: windows, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, goversion: '1.20' }
  73. - { goos: windows, goarch: amd64, goamd64: v3, output: amd64-go120, goversion: '1.20' }
  74. # Go 1.20 is the last release that will run on macOS 10.13 High Sierra or 10.14 Mojave. Go 1.21 will require macOS 10.15 Catalina or later.
  75. - { goos: darwin, goarch: arm64, output: arm64-go120, goversion: '1.20' }
  76. - { goos: darwin, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, goversion: '1.20' }
  77. - { goos: darwin, goarch: amd64, goamd64: v3, output: amd64-go120, goversion: '1.20' }
  78. # only for test
  79. - { goos: linux, goarch: '386', output: '386-go120', goversion: '1.20' }
  80. - { goos: linux, goarch: amd64, goamd64: v1, output: amd64-compatible-go120, goversion: '1.20', test: test }
  81. - { goos: linux, goarch: amd64, goamd64: v3, output: amd64-go120, goversion: '1.20' }
  82. steps:
  83. - uses: actions/checkout@v4
  84. - name: Set up Go
  85. if: ${{ matrix.jobs.goversion == '' && matrix.jobs.goarch != 'loong64' }}
  86. uses: actions/setup-go@v5
  87. with:
  88. go-version: '1.22'
  89. - name: Set up Go
  90. if: ${{ matrix.jobs.goversion != '' && matrix.jobs.goarch != 'loong64' }}
  91. uses: actions/setup-go@v5
  92. with:
  93. go-version: ${{ matrix.jobs.goversion }}
  94. - name: Set up Go1.22 loongarch abi1
  95. if: ${{ matrix.jobs.goarch == 'loong64' && matrix.jobs.abi == '1' }}
  96. run: |
  97. wget -q https://github.com/xishang0128/loongarch64-golang/releases/download/1.22.0/go1.22.0.linux-amd64-abi1.tar.gz
  98. sudo tar zxf go1.22.0.linux-amd64-abi1.tar.gz -C /usr/local
  99. echo "/usr/local/go/bin" >> $GITHUB_PATH
  100. - name: Set up Go1.22 loongarch abi2
  101. if: ${{ matrix.jobs.goarch == 'loong64' && matrix.jobs.abi == '2' }}
  102. run: |
  103. wget -q https://github.com/xishang0128/loongarch64-golang/releases/download/1.22.0/go1.22.0.linux-amd64-abi2.tar.gz
  104. sudo tar zxf go1.22.0.linux-amd64-abi2.tar.gz -C /usr/local
  105. echo "/usr/local/go/bin" >> $GITHUB_PATH
  106. # modify from https://github.com/restic/restic/issues/4636#issuecomment-1896455557
  107. # this patch file only works on golang1.22.x
  108. # that means after golang1.23 release it must be changed
  109. # revert:
  110. # 693def151adff1af707d82d28f55dba81ceb08e1: "crypto/rand,runtime: switch RtlGenRandom for ProcessPrng"
  111. # 7c1157f9544922e96945196b47b95664b1e39108: "net: remove sysSocket fallback for Windows 7"
  112. # 48042aa09c2f878c4faa576948b07fe625c4707a: "syscall: remove Windows 7 console handle workaround"
  113. - name: Revert Golang1.22 commit for Windows7/8
  114. if: ${{ matrix.jobs.goos == 'windows' && matrix.jobs.goversion == '' }}
  115. run: |
  116. cd $(go env GOROOT)
  117. patch --verbose -R -p 1 < $GITHUB_WORKSPACE/.github/patch_go122/693def151adff1af707d82d28f55dba81ceb08e1.diff
  118. patch --verbose -R -p 1 < $GITHUB_WORKSPACE/.github/patch_go122/7c1157f9544922e96945196b47b95664b1e39108.diff
  119. patch --verbose -R -p 1 < $GITHUB_WORKSPACE/.github/patch_go122/48042aa09c2f878c4faa576948b07fe625c4707a.diff
  120. # modify from https://github.com/restic/restic/issues/4636#issuecomment-1896455557
  121. - name: Revert Golang1.21 commit for Windows7/8
  122. if: ${{ matrix.jobs.goos == 'windows' && matrix.jobs.goversion == '1.21' }}
  123. run: |
  124. cd $(go env GOROOT)
  125. curl https://github.com/golang/go/commit/9e43850a3298a9b8b1162ba0033d4c53f8637571.diff | patch --verbose -R -p 1
  126. - name: Set variables
  127. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }}
  128. run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
  129. shell: bash
  130. - name: Set variables
  131. if: ${{ github.event_name != 'workflow_dispatch' && github.ref_name == 'Alpha' }}
  132. run: echo "VERSION=alpha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
  133. shell: bash
  134. - name: Set Time Variable
  135. run: |
  136. echo "BUILDTIME=$(date)" >> $GITHUB_ENV
  137. echo "CGO_ENABLED=0" >> $GITHUB_ENV
  138. echo "BUILDTAG=-extldflags --static" >> $GITHUB_ENV
  139. - name: Setup NDK
  140. if: ${{ matrix.jobs.goos == 'android' }}
  141. uses: nttld/setup-ndk@v1
  142. id: setup-ndk
  143. with:
  144. ndk-version: r26c
  145. - name: Set NDK path
  146. if: ${{ matrix.jobs.goos == 'android' }}
  147. run: |
  148. echo "CC=${{steps.setup-ndk.outputs.ndk-path}}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{matrix.jobs.ndk}}-clang" >> $GITHUB_ENV
  149. echo "CGO_ENABLED=1" >> $GITHUB_ENV
  150. echo "BUILDTAG=" >> $GITHUB_ENV
  151. - name: Test
  152. if: ${{ matrix.jobs.test == 'test' }}
  153. run: |
  154. go test ./...
  155. - name: Update CA
  156. run: |
  157. sudo apt-get install ca-certificates
  158. sudo update-ca-certificates
  159. cp -f /etc/ssl/certs/ca-certificates.crt component/ca/ca-certificates.crt
  160. - name: Build core
  161. env:
  162. GOOS: ${{matrix.jobs.goos}}
  163. GOARCH: ${{matrix.jobs.goarch}}
  164. GOAMD64: ${{matrix.jobs.goamd64}}
  165. GOARM: ${{matrix.jobs.arm}}
  166. GOMIPS: ${{matrix.jobs.mips}}
  167. run: |
  168. echo $CGO_ENABLED
  169. go build -v -tags "with_gvisor" -trimpath -ldflags "${BUILDTAG} -X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid="
  170. if [ "${{matrix.jobs.goos}}" = "windows" ]; then
  171. cp mihomo.exe mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe
  172. zip -r mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.zip mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}.exe
  173. else
  174. cp mihomo mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}
  175. gzip -c mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}} > mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.gz
  176. rm mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}
  177. fi
  178. - name: Create DEB package
  179. if: ${{ matrix.jobs.goos == 'linux' && !contains(matrix.jobs.goarch, 'mips') }}
  180. run: |
  181. sudo apt-get install dpkg
  182. if [ "${{matrix.jobs.abi}}" = "1" ]; then
  183. ARCH=loongarch64
  184. elif [ "${{matrix.jobs.goarm}}" = "7" ]; then
  185. ARCH=armhf
  186. elif [ "${{matrix.jobs.goarch}}" = "arm" ]; then
  187. ARCH=armel
  188. else
  189. ARCH=${{matrix.jobs.goarch}}
  190. fi
  191. PackageVersion=$(curl -s "https://api.github.com/repos/MetaCubeX/mihomo/releases/latest" | grep -o '"tag_name": "[^"]*' | grep -o '[^"]*$' | sed 's/v//g' )
  192. if [ $(git branch | awk -F ' ' '{print $2}') = "Alpha" ]; then
  193. PackageVersion="$(echo "${PackageVersion}" | awk -F '.' '{$NF = $NF + 1; print}' OFS='.')-${VERSION}"
  194. fi
  195. mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/DEBIAN
  196. mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/usr/bin
  197. mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/etc/mihomo
  198. mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/etc/systemd/system/
  199. mkdir -p mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/usr/share/licenses/mihomo
  200. cp mihomo mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/usr/bin/mihomo
  201. cp LICENSE mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/usr/share/licenses/mihomo/
  202. cp .github/mihomo.service mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/etc/systemd/system/
  203. cat > mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/etc/mihomo/config.yaml <<EOF
  204. mixed-port: 7890
  205. external-controller: 127.0.0.1:9090
  206. EOF
  207. cat > mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}/DEBIAN/control <<EOF
  208. Package: mihomo
  209. Version: ${PackageVersion}
  210. Section:
  211. Priority: extra
  212. Architecture: ${ARCH}
  213. Maintainer: MetaCubeX <none@example.com>
  214. Homepage: https://wiki.metacubex.one/
  215. Description: The universal proxy platform.
  216. EOF
  217. dpkg-deb -Z gzip --build mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}
  218. - name: Convert DEB to RPM
  219. if: ${{ matrix.jobs.goos == 'linux' && !contains(matrix.jobs.goarch, 'mips') }}
  220. run: |
  221. sudo apt-get install -y alien
  222. alien --to-rpm --scripts mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.deb
  223. mv mihomo*.rpm mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.rpm
  224. # - name: Convert DEB to PKG
  225. # if: ${{ matrix.jobs.goos == 'linux' && !contains(matrix.jobs.goarch, 'mips') && !contains(matrix.jobs.goarch, 'loong64') }}
  226. # run: |
  227. # docker pull archlinux
  228. # docker run --rm -v ./:/mnt archlinux bash -c "
  229. # pacman -Syu pkgfile base-devel --noconfirm
  230. # curl -L https://github.com/helixarch/debtap/raw/master/debtap > /usr/bin/debtap
  231. # chmod 755 /usr/bin/debtap
  232. # debtap -u
  233. # debtap -Q /mnt/mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.deb
  234. # "
  235. # mv mihomo*.pkg.tar.zst mihomo-${{matrix.jobs.goos}}-${{matrix.jobs.output}}-${VERSION}.pkg.tar.zst
  236. - name: Save version
  237. run: |
  238. echo ${VERSION} > version.txt
  239. shell: bash
  240. - name: Archive production artifacts
  241. uses: actions/upload-artifact@v4
  242. with:
  243. name: "${{ matrix.jobs.goos }}-${{ matrix.jobs.output }}"
  244. path: |
  245. mihomo*.gz
  246. mihomo*.deb
  247. mihomo*.rpm
  248. mihomo*.zip
  249. version.txt
  250. Upload-Prerelease:
  251. permissions: write-all
  252. if: ${{ github.event_name != 'workflow_dispatch' && github.ref_type == 'branch' && !startsWith(github.event_name, 'pull_request') }}
  253. needs: [build]
  254. runs-on: ubuntu-latest
  255. steps:
  256. - name: Download all workflow run artifacts
  257. uses: actions/download-artifact@v4
  258. with:
  259. path: bin/
  260. merge-multiple: true
  261. - name: Delete current release assets
  262. uses: 8Mi-Tech/delete-release-assets-action@main
  263. with:
  264. github_token: ${{ secrets.GITHUB_TOKEN }}
  265. tag: Prerelease-${{ github.ref_name }}
  266. deleteOnlyFromDrafts: false
  267. - name: Set Env
  268. run: |
  269. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  270. shell: bash
  271. - name: Tag Repo
  272. uses: richardsimko/update-tag@v1
  273. with:
  274. tag_name: Prerelease-${{ github.ref_name }}
  275. env:
  276. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  277. - run: |
  278. cat > release.txt << 'EOF'
  279. Release created at ${{ env.BUILDTIME }}
  280. Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version
  281. <br>
  282. [我应该下载哪个文件? / Which file should I download?](https://github.com/MetaCubeX/mihomo/wiki/FAQ)
  283. [二进制文件筛选 / Binary file selector](https://metacubex.github.io/Meta-Docs/startup/#_1)
  284. [查看文档 / Docs](https://metacubex.github.io/Meta-Docs/)
  285. EOF
  286. - name: Upload Prerelease
  287. uses: softprops/action-gh-release@v1
  288. if: ${{ success() }}
  289. with:
  290. tag_name: Prerelease-${{ github.ref_name }}
  291. files: |
  292. bin/*
  293. prerelease: true
  294. generate_release_notes: true
  295. body_path: release.txt
  296. Upload-Release:
  297. permissions: write-all
  298. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }}
  299. needs: [build]
  300. runs-on: ubuntu-latest
  301. steps:
  302. - name: Checkout
  303. uses: actions/checkout@v4
  304. with:
  305. ref: Meta
  306. fetch-depth: '0'
  307. fetch-tags: 'true'
  308. - name: Get tags
  309. run: |
  310. echo "CURRENTVERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
  311. git fetch --tags
  312. echo "PREVERSION=$(git describe --tags --abbrev=0 HEAD)" >> $GITHUB_ENV
  313. - name: Merge Alpha branch into Meta
  314. run: |
  315. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  316. git config --global user.name "github-actions[bot]"
  317. git fetch origin Alpha:Alpha
  318. git merge Alpha
  319. git push origin Meta
  320. env:
  321. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  322. - name: Tag the commit
  323. run: |
  324. git tag ${{ github.event.inputs.version }}
  325. git push origin ${{ github.event.inputs.version }}
  326. env:
  327. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  328. - name: Generate release notes
  329. run: |
  330. cp ./.github/genReleaseNote.sh ./
  331. bash ./genReleaseNote.sh -v ${PREVERSION}...${CURRENTVERSION}
  332. rm ./genReleaseNote.sh
  333. - uses: actions/download-artifact@v4
  334. with:
  335. path: bin/
  336. merge-multiple: true
  337. - name: Display structure of downloaded files
  338. run: ls -R
  339. working-directory: bin
  340. - name: Upload Release
  341. uses: softprops/action-gh-release@v2
  342. if: ${{ success() }}
  343. with:
  344. tag_name: ${{ github.event.inputs.version }}
  345. files: bin/*
  346. body_path: release.md
  347. Docker:
  348. if: ${{ !startsWith(github.event_name, 'pull_request') }}
  349. permissions: write-all
  350. needs: [build]
  351. runs-on: ubuntu-latest
  352. steps:
  353. - name: Checkout repository
  354. uses: actions/checkout@v4
  355. with:
  356. fetch-depth: 0
  357. - uses: actions/download-artifact@v4
  358. with:
  359. path: bin/
  360. merge-multiple: true
  361. - name: Display structure of downloaded files
  362. run: ls -R
  363. working-directory: bin
  364. - name: Set up QEMU
  365. uses: docker/setup-qemu-action@v3
  366. - name: Setup Docker buildx
  367. uses: docker/setup-buildx-action@v3
  368. with:
  369. version: latest
  370. # Extract metadata (tags, labels) for Docker
  371. # https://github.com/docker/metadata-action
  372. - name: Extract Docker metadata
  373. if: ${{ github.event_name != 'workflow_dispatch' }}
  374. id: meta_alpha
  375. uses: docker/metadata-action@v5
  376. with:
  377. images: '${{ env.REGISTRY }}/${{ github.repository }}'
  378. # Extract metadata (tags, labels) for Docker
  379. # https://github.com/docker/metadata-action
  380. - name: Extract Docker metadata
  381. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }}
  382. id: meta_release
  383. uses: docker/metadata-action@v5
  384. with:
  385. images: '${{ env.REGISTRY }}/${{ github.repository }}'
  386. tags: |
  387. ${{ github.event.inputs.version }}
  388. flavor: |
  389. latest=true
  390. labels: org.opencontainers.image.version=${{ github.event.inputs.version }}
  391. - name: Show files
  392. run: |
  393. ls .
  394. ls bin/
  395. - name: login to docker REGISTRY
  396. uses: docker/login-action@v3
  397. with:
  398. registry: ${{ env.REGISTRY }}
  399. username: ${{ secrets.DOCKER_HUB_USER }}
  400. password: ${{ secrets.DOCKER_HUB_TOKEN }}
  401. # Build and push Docker image with Buildx (don't push on PR)
  402. # https://github.com/docker/build-push-action
  403. - name: Build and push Docker image
  404. if: ${{ github.event_name != 'workflow_dispatch' }}
  405. uses: docker/build-push-action@v5
  406. with:
  407. context: .
  408. file: ./Dockerfile
  409. push: ${{ github.event_name != 'pull_request' }}
  410. platforms: |
  411. linux/386
  412. linux/amd64
  413. linux/arm64
  414. linux/arm/v7
  415. tags: ${{ steps.meta_alpha.outputs.tags }}
  416. labels: ${{ steps.meta_alpha.outputs.labels }}
  417. - name: Build and push Docker image
  418. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }}
  419. uses: docker/build-push-action@v5
  420. with:
  421. context: .
  422. file: ./Dockerfile
  423. push: ${{ github.event_name != 'pull_request' }}
  424. platforms: |
  425. linux/386
  426. linux/amd64
  427. linux/arm64
  428. linux/arm/v7
  429. tags: ${{ steps.meta_release.outputs.tags }}
  430. labels: ${{ steps.meta_release.outputs.labels }}