|
1 | | -name: Cross-Compile TCC for Windows & Linux |
| 1 | +name: Cross-Compile TCC |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
7 | 7 | pull_request: |
8 | 8 | branches: |
9 | 9 | - mob |
10 | | - workflow_dispatch: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
11 | 13 |
|
12 | 14 | jobs: |
13 | 15 | build: |
14 | 16 | runs-on: ubuntu-latest |
15 | 17 |
|
16 | 18 | steps: |
17 | | - - name: Checkout source code |
| 19 | + - name: Checkout TCC source code |
18 | 20 | uses: actions/checkout@v4 |
19 | 21 | with: |
20 | 22 | repository: Tiny-C-Compiler/mirror-repository |
21 | 23 | ref: mob |
22 | | - fetch-depth: 0 |
23 | 24 |
|
24 | 25 | - name: Install dependencies |
25 | 26 | run: | |
26 | | - echo "Installing dependencies..." |
27 | | - sudo apt update |
28 | | - sudo apt install -y mingw-w64 build-essential make autoconf |
29 | | -
|
30 | | - - name: Debug: Verify installed compilers |
31 | | - run: | |
32 | | - echo "GCC version:" |
33 | | - gcc --version |
34 | | - echo "MinGW-w64 version:" |
35 | | - x86_64-w64-mingw32-gcc --version |
| 27 | + sudo apt-get update |
| 28 | + sudo apt-get install -y mingw-w64 gcc-mingw-w64 make autoconf automake |
36 | 29 |
|
37 | | - - name: Extract version info |
| 30 | + - name: Debug environment |
38 | 31 | run: | |
39 | | - echo "Extracting version info..." |
40 | | - TCC_VERSION=$(head -n 1 VERSION) |
41 | | - echo "TCC Version: $TCC_VERSION" |
42 | | - echo "TCC_VERSION=$TCC_VERSION" >> $GITHUB_ENV |
| 32 | + echo "PATH: $PATH" |
| 33 | + echo "GCC Version: $(gcc --version)" |
| 34 | + echo "MinGW-w64 Version: $(x86_64-w64-mingw32-gcc --version)" |
43 | 35 |
|
44 | 36 | - name: Compile for Linux |
45 | 37 | run: | |
46 | | - echo "Compiling for Linux..." |
47 | 38 | ./configure |
48 | 39 | make -j$(nproc) |
49 | 40 | strip tcc |
50 | 41 | mv tcc tcc-linux |
51 | 42 |
|
52 | | - - name: Compile for Windows (Cross-Compile) |
| 43 | + - name: Compile for Windows (cross-compile) |
53 | 44 | run: | |
54 | | - echo "Compiling for Windows..." |
55 | 45 | ./configure --cross-prefix=x86_64-w64-mingw32- |
56 | 46 | make -j$(nproc) |
57 | | - strip tcc.exe |
| 47 | + x86_64-w64-mingw32-strip tcc.exe |
58 | 48 | mv tcc.exe tcc-windows.exe |
59 | 49 |
|
60 | | - - name: Debug: List built binaries |
61 | | - run: ls -lh tcc-linux tcc-windows.exe |
62 | | - |
63 | | - - name: Create Release Assets |
| 50 | + - name: Create release artifacts |
64 | 51 | run: | |
65 | 52 | mkdir release |
66 | 53 | mv tcc-linux release/tcc-linux |
67 | 54 | mv tcc-windows.exe release/tcc-windows.exe |
68 | | - tar -czvf tcc-linux.tar.gz -C release tcc-linux |
69 | | - zip -r tcc-windows.zip release/tcc-windows.exe |
70 | | - ls -lh tcc-linux.tar.gz tcc-windows.zip |
| 55 | + tar -czvf tcc-latest-linux.tar.gz -C release tcc-linux |
| 56 | + zip -r tcc-latest-windows.zip release/tcc-windows.exe |
71 | 57 |
|
72 | | - - name: Upload to GitHub Releases |
| 58 | + - name: Upload release to GitHub |
73 | 59 | uses: softprops/action-gh-release@v2 |
74 | 60 | with: |
75 | | - token: ${{ secrets.GITHUB_TOKEN }} |
76 | 61 | tag_name: latest |
77 | | - repository: Tiny-C-Compiler/mirror-repository |
78 | | - name: "Latest TinyCC Build" |
79 | | - body: "Automated build for TinyCC (Linux & Windows)." |
80 | | - draft: false |
81 | | - prerelease: false |
82 | 62 | files: | |
83 | | - tcc-linux.tar.gz |
84 | | - tcc-windows.zip |
| 63 | + tcc-latest-linux.tar.gz |
| 64 | + tcc-latest-windows.zip |
| 65 | + repository: Tiny-C-Compiler/mirror-repository |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments