Skip to content

Commit a754801

Browse files
Refactor GitHub Actions workflow for dependency installation
1 parent 060442b commit a754801

1 file changed

Lines changed: 23 additions & 17 deletions

File tree

.github/workflows/main.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@ jobs:
1616
- name: Checkout code
1717
uses: actions/checkout@v3
1818

19-
- name: Install GCC
20-
run: sudo apt-get install build-essential -y
21-
2219
- name: Install dependencies
2320
run: |
2421
sudo apt-get update
25-
sudo apt-get install -y clang curl
22+
sudo apt-get install -y \
23+
build-essential \
24+
clang \
25+
curl \
26+
libcurl4-openssl-dev
2627
27-
28-
29-
3028
- name: Build C Project
3129
run: gcc Flash-cli.c -o flash-linux-x64 -lcurl
3230

@@ -41,17 +39,26 @@ jobs:
4139
fi
4240
4341
# -------------------------------------------------------
44-
# 2. RELEASE JOB (Runs only on push to main, PR merged)
42+
# 2. RELEASE JOB (Runs only on push to main)
4543
# -------------------------------------------------------
4644
release:
4745
needs: ci
48-
if: github.event_name == 'push' && contains(github.event.head_commit.message, 'Merge pull request') == false
46+
if: github.event_name == 'push'
4947
runs-on: ubuntu-latest
5048

5149
steps:
5250
- name: Checkout code
5351
uses: actions/checkout@v3
5452

53+
- name: Install dependencies
54+
run: |
55+
sudo apt-get update
56+
sudo apt-get install -y \
57+
build-essential \
58+
clang \
59+
curl \
60+
libcurl4-openssl-dev
61+
5562
# Detect if version.h changed
5663
- name: Check if version file changed
5764
id: check_version
@@ -66,29 +73,28 @@ jobs:
6673
- name: Stop if version did not change
6774
if: env.changed == 'false'
6875
run: |
69-
echo "version.h not changed → Skip release"
76+
echo "version.h not changed → skip release"
7077
exit 0
7178
7279
- name: Extract version from version.h
7380
run: |
7481
VERSION=$(grep "RELEASE_VERSION" lib/version.h | cut -d '"' -f2)
7582
echo "VERSION=$VERSION" >> $GITHUB_ENV
7683
77-
- name: Build binary
78-
run: gcc src/*.c -o flash-http
84+
# Linux build of final binary
85+
- name: Build Linux binary
86+
run: gcc Flash-cli.c -o flash-linux-x64 -lcurl
7987

80-
# Release Title Logic
88+
# Determine release title
8189
- name: Decide Release Title
8290
run: |
83-
if [ "${{ github.event_name }}" = "push" ]; then
84-
echo "TITLE=${{ github.event.head_commit.message }}" >> $GITHUB_ENV
85-
fi
91+
echo "TITLE=${{ github.event.head_commit.message }}" >> $GITHUB_ENV
8692
8793
- name: Create GitHub Release
8894
uses: softprops/action-gh-release@v1
8995
with:
9096
name: "${{ env.TITLE }} (v${{ env.VERSION }})"
9197
tag_name: "v${{ env.VERSION }}"
92-
files: flash-http
98+
files: flash-linux-x64
9399
env:
94100
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)