Skip to content

Commit 78e4521

Browse files
authored
Update release-crosscompile.yml
1 parent ae0f831 commit 78e4521

File tree

1 file changed

+53
-44
lines changed

1 file changed

+53
-44
lines changed
Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,76 @@
1-
name: Cross-Compile TCC
1+
name: Build and Release TCC (mob branch)
22

33
on:
4-
push:
5-
branches:
6-
- mob
7-
pull_request:
8-
branches:
9-
- mob
104
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
119
permissions:
1210
contents: write
1311

1412
jobs:
1513
build:
14+
name: Compile TCC for multiple targets
1615
runs-on: ubuntu-latest
1716

17+
strategy:
18+
matrix:
19+
target: [linux-x86_64, windows-x86_64, linux-arm]
20+
1821
steps:
19-
- name: Checkout TCC source code
20-
uses: actions/checkout@v4
21-
with:
22-
repository: Tiny-C-Compiler/mirror-repository
23-
ref: mob
22+
- name: Download TCC source (mob branch)
23+
run: |
24+
wget -O tcc-mob.zip https://github.com/Tiny-C-Compiler/mirror-repository/archive/refs/heads/mob.zip
25+
unzip tcc-mob.zip
26+
mv mirror-repository-mob tcc
27+
cd tcc
2428
2529
- name: Install dependencies
2630
run: |
2731
sudo apt-get update
28-
sudo apt-get install -y mingw-w64 gcc-mingw-w64 make autoconf automake
32+
sudo apt-get install -y build-essential mingw-w64 gcc-arm-linux-gnueabi
2933
30-
- name: Debug environment
34+
- name: Configure and Build
3135
run: |
32-
echo "PATH: $PATH"
33-
echo "GCC Version: $(gcc --version)"
34-
echo "MinGW-w64 Version: $(x86_64-w64-mingw32-gcc --version)"
36+
cd tcc
37+
case "${{ matrix.target }}" in
38+
linux-x86_64)
39+
./configure --prefix=/usr
40+
make -j$(nproc)
41+
mv tcc ../tcc-linux-x86_64
42+
;;
43+
windows-x86_64)
44+
./configure --cc=x86_64-w64-mingw32-gcc --prefix=/usr
45+
make -j$(nproc)
46+
mv tcc.exe ../tcc-windows-x86_64.exe
47+
;;
48+
linux-arm)
49+
./configure --cc=arm-linux-gnueabi-gcc --prefix=/usr
50+
make -j$(nproc)
51+
mv tcc ../tcc-linux-arm
52+
;;
53+
esac
3554
36-
- name: Compile for Linux
37-
run: |
38-
./configure
39-
make -j$(nproc)
40-
strip tcc
41-
mv tcc tcc-linux
55+
- name: Upload artifacts
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: tcc-${{ matrix.target }}
59+
path: tcc-*
4260

43-
- name: Compile for Windows (cross-compile)
44-
run: |
45-
./configure --cross-prefix=x86_64-w64-mingw32-
46-
make -j$(nproc)
47-
x86_64-w64-mingw32-strip tcc.exe
48-
mv tcc.exe tcc-windows.exe
61+
release:
62+
name: Create GitHub Release
63+
runs-on: ubuntu-latest
64+
needs: build
4965

50-
- name: Create release artifacts
51-
run: |
52-
mkdir release
53-
mv tcc-linux release/tcc-linux
54-
mv tcc-windows.exe release/tcc-windows.exe
55-
tar -czvf tcc-latest-linux.tar.gz -C release tcc-linux
56-
zip -r tcc-latest-windows.zip release/tcc-windows.exe
66+
steps:
67+
- name: Download artifacts
68+
uses: actions/download-artifact@v4
69+
with:
70+
path: artifacts
5771

58-
- name: Upload release to GitHub
72+
- name: Create a release
5973
uses: softprops/action-gh-release@v2
6074
with:
61-
tag_name: latest
62-
files: |
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 }}
75+
files: artifacts/**/*
76+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)