|
1 | | -name: Build Binaries |
| 1 | +name: Commit Dist Artifacts |
| 2 | + |
| 3 | +# Publishes binaries built by "Build Binaries" back into dist/ on main. |
2 | 4 |
|
3 | 5 | on: |
4 | | - push: |
5 | | - branches: ['main'] |
6 | | - tags: ['v*'] |
7 | | - pull_request: |
| 6 | + workflow_run: |
| 7 | + workflows: ["Build Binaries"] |
| 8 | + types: [completed] |
8 | 9 | branches: ['main'] |
9 | | - workflow_dispatch: |
10 | 10 |
|
11 | 11 | permissions: |
12 | 12 | contents: write |
| 13 | + actions: read |
13 | 14 |
|
14 | 15 | jobs: |
15 | | - build: |
16 | | - runs-on: ${{ matrix.os }} |
17 | | - strategy: |
18 | | - matrix: |
19 | | - include: |
20 | | - - os: ubuntu-24.04 |
21 | | - name: linux |
22 | | - arch: amd64 |
23 | | - - os: ubuntu-24.04-arm |
24 | | - name: linux |
25 | | - arch: arm64 |
26 | | - - os: windows-latest |
27 | | - name: windows |
28 | | - arch: amd64 |
29 | | - - os: macos-latest |
30 | | - name: macos |
31 | | - arch: arm64 |
32 | | - - os: macos-15-intel |
33 | | - name: macos |
34 | | - arch: amd64 |
35 | | - |
36 | | - steps: |
37 | | - - uses: actions/checkout@v4 |
38 | | - |
39 | | - - name: Build binary (Linux in Ubuntu 25.10 container) |
40 | | - if: matrix.name == 'linux' |
41 | | - shell: bash |
42 | | - run: | |
43 | | - # Docker container with Ubuntu 25.10 and build the binary inside it |
44 | | - rm -rf dist/* |
45 | | - docker run --rm \ |
46 | | - -v "$PWD:/workspace" \ |
47 | | - -w /workspace \ |
48 | | - ubuntu:25.10 \ |
49 | | - bash -c " |
50 | | - set -e |
51 | | - echo 'Setting up Ubuntu 25.10 build environment...' |
52 | | - |
53 | | - apt-get update -y |
54 | | - apt-get install -y --fix-missing curl python3 python3-pip python3-venv binutils |
55 | | - |
56 | | - # Install uv (Python package manager) |
57 | | - curl -LsSf https://astral.sh/uv/install.sh | sh |
58 | | - export PATH=\"\$HOME/.local/bin:\$PATH\" |
59 | | - |
60 | | - echo 'Building binary with uv...' |
61 | | - uv sync |
62 | | - uv run build.py |
63 | | - |
64 | | - echo 'Build completed. Checking output:' |
65 | | - ls -la dist/ |
66 | | - " |
67 | | - |
68 | | - - name: Setup uv for Windows/macOS |
69 | | - if: matrix.name != 'linux' |
70 | | - uses: astral-sh/setup-uv@v4 |
71 | | - |
72 | | - - name: Build binary (Windows/macOS native) |
73 | | - if: matrix.name != 'linux' |
74 | | - shell: bash |
75 | | - run: | |
76 | | - rm -rf dist/* |
77 | | - uv sync |
78 | | - uv run build.py |
79 | | - |
80 | | - - name: Upload artifacts |
81 | | - uses: actions/upload-artifact@v4 |
82 | | - with: |
83 | | - name: perfecto-mcp-${{ matrix.name }}-${{ matrix.arch }} |
84 | | - path: dist/ |
85 | | - |
86 | 16 | commit-artifacts: |
87 | | - needs: build |
88 | 17 | runs-on: ubuntu-latest |
89 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 18 | + if: github.event.workflow_run.conclusion == 'success' |
90 | 19 | steps: |
91 | | - - uses: actions/checkout@v4 |
92 | | - |
93 | | - - name: Download all artifacts |
94 | | - uses: actions/download-artifact@v4 |
| 20 | + - uses: actions/checkout@v6 |
| 21 | + with: |
| 22 | + token: ${{ secrets.REPO_PUSH_PAT || secrets.GITHUB_TOKEN }} |
| 23 | + |
| 24 | + - name: Download all artifacts from triggering Build Binaries run |
| 25 | + uses: actions/download-artifact@v7 |
95 | 26 | with: |
96 | 27 | path: artifacts/ |
97 | | - |
| 28 | + run-id: ${{ github.event.workflow_run.id }} |
| 29 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + |
98 | 31 | - name: Organize artifacts into dist/ |
99 | 32 | shell: bash |
100 | 33 | run: | |
|
138 | 71 |
|
139 | 72 | echo "Final dist/ contents:" |
140 | 73 | ls -la dist/ || echo "No dist/ directory found" |
141 | | - |
| 74 | +
|
142 | 75 | - name: Commit all artifacts to repository |
143 | 76 | shell: bash |
144 | 77 | run: | |
|
151 | 84 | git commit -m "[skip ci] Update all binary artifacts" |
152 | 85 | git push |
153 | 86 | fi |
154 | | -
|
0 commit comments