Skip to content

Commit f6d0997

Browse files
authored
Update release-crosscompile.yml
1 parent b72ef42 commit f6d0997

File tree

1 file changed

+37
-85
lines changed

1 file changed

+37
-85
lines changed
Lines changed: 37 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,62 @@
1-
name: Cross-Compile & Release
1+
name: Cross-Compile TinyCC
22

33
on:
44
push:
55
branches:
6-
- main
7-
workflow_dispatch:
6+
- main # Change to the branch you want to trigger on
87

98
jobs:
109
build:
10+
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
os: [ubuntu-latest, windows-latest]
14-
runs-on: ${{ matrix.os }}
13+
target: [linux, windows]
14+
1515
steps:
16-
- name: Checkout source
17-
uses: actions/checkout@v3
18-
19-
# --- Setup build dependencies
20-
- name: Setup Linux build tools
21-
if: matrix.os == 'ubuntu-latest'
22-
run: |
23-
sudo apt-get update
24-
sudo apt-get install -y build-essential
25-
26-
- name: Setup Windows build tools
27-
if: matrix.os == 'windows-latest'
16+
- name: Checkout Source
17+
uses: actions/checkout@v4
18+
19+
- name: Install Dependencies
2820
run: |
29-
choco install mingw -y
30-
shell: powershell
21+
sudo apt update
22+
sudo apt install -y mingw-w64 build-essential
3123
32-
# --- Run your build script (adjust commands as needed)
33-
- name: Build TinyCC
24+
- name: Build for Linux
25+
if: matrix.target == 'linux'
3426
run: |
35-
if [ "$(uname -s)" = "Linux" ]; then
36-
# For Linux, assume you have a Makefile
37-
make clean && make
38-
else
39-
# For Windows, run your batch file
40-
./build-tcc.bat
41-
fi
42-
shell: bash
27+
./configure
28+
make -j$(nproc)
29+
tar -czvf tinycc-linux.tar.gz tcc
4330
44-
# --- Collect artifacts (adjust paths to your outputs)
45-
- name: Prepare artifact folder
31+
- name: Build for Windows
32+
if: matrix.target == 'windows'
4633
run: |
47-
mkdir artifact
48-
# For example, copy the built binaries or ZIP files:
49-
cp tcc.exe artifact/ 2>/dev/null || true
50-
cp libtcc.dll artifact/ 2>/dev/null || true
51-
cp -r some_output_folder artifact/ 2>/dev/null || true
34+
./configure --cross-prefix=x86_64-w64-mingw32-
35+
make -j$(nproc)
36+
zip -r tinycc-windows.zip tcc.exe
5237
53-
- name: Upload artifact
54-
uses: actions/upload-artifact@v3
38+
- name: Upload Artifacts
39+
uses: actions/upload-artifact@v4
5540
with:
56-
name: build-${{ matrix.os }}
57-
path: artifact/
58-
41+
name: tinycc-${{ matrix.target }}
42+
path: tinycc-*.*
43+
5944
release:
6045
needs: build
6146
runs-on: ubuntu-latest
62-
steps:
63-
- name: Download Linux artifact
64-
uses: actions/download-artifact@v3
65-
with:
66-
name: build-ubuntu-latest
6747

68-
- name: Download Windows artifact
69-
uses: actions/download-artifact@v3
48+
steps:
49+
- name: Download Artifacts
50+
uses: actions/download-artifact@v4
7051
with:
71-
name: build-windows-latest
52+
path: artifacts
7253

73-
# --- Combine both artifacts into one release folder and zip them
74-
- name: Prepare release package
75-
run: |
76-
mkdir release
77-
cp -r build-ubuntu-latest/* release/ || true
78-
cp -r build-windows-latest/* release/ || true
79-
cd release
80-
zip -r ../latest-release.zip .
81-
82-
# --- Clone the mirror repository (branch "mob") using a dedicated token
83-
- name: Checkout mirror repository
84-
uses: actions/checkout@v3
54+
- name: Create GitHub Release
55+
uses: softprops/action-gh-release@v2
8556
with:
57+
tag_name: latest
8658
repository: Tiny-C-Compiler/mirror-repository
87-
ref: mob
88-
token: ${{ secrets.MIRROR_REPO_TOKEN }}
89-
path: mirror
90-
91-
# --- Copy the release package into the mirror repository and push changes
92-
- name: Update mirror repository with new release
93-
run: |
94-
cp latest-release.zip mirror/
95-
cd mirror
96-
git config user.name "github-actions[bot]"
97-
git config user.email "github-actions[bot]@users.noreply.github.com"
98-
git add latest-release.zip
99-
git commit -m "Update latest release" || echo "No changes to commit"
100-
git push origin mob
101-
102-
# --- Create or update a GitHub Release on the mirror repository using gh CLI
103-
- name: Create GitHub Release in mirror repository
104-
run: |
105-
gh release create latest latest-release.zip \
106-
--repo Tiny-C-Compiler/mirror-repository \
107-
--title "Latest Release" \
108-
--notes "Automated build and release on $(date -u)"
109-
env:
110-
GITHUB_TOKEN: ${{ secrets.MIRROR_REPO_TOKEN }}
59+
files: artifacts/tinycc-*/tinycc-*
60+
token: ${{ secrets.GITHUB_TOKEN }}
61+
prerelease: true
62+
draft: false

0 commit comments

Comments
 (0)