Skip to content

Commit 3e99f02

Browse files
committed
Refactor GitHub Actions workflows: consolidate validation steps, upgrade actions/checkout and actions/setup-python to v6, and streamline build steps for Windows, MacOS, and Linux executables.
1 parent a2dd2a0 commit 3e99f02

1 file changed

Lines changed: 48 additions & 127 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -12,78 +12,47 @@ concurrency:
1212

1313
jobs:
1414
validate:
15-
name: Validate Build
16-
runs-on: ubuntu-latest
17-
permissions:
18-
contents: read
19-
strategy:
20-
fail-fast: true
21-
matrix:
22-
python-version:
23-
["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
24-
25-
steps:
26-
- uses: actions/checkout@v4
27-
28-
- name: 🔐 Validate VERSION tag
29-
run: |
30-
[ "${GITHUB_REF##*/}" == "v$(head -n 1 lncrawl/VERSION)" ] || exit 100
31-
32-
- name: 🐍 Set up Python ${{ matrix.python-version }}
33-
uses: actions/setup-python@v5
34-
with:
35-
python-version: ${{ matrix.python-version }}
36-
37-
- name: 📦 Install uv
38-
run: |
39-
curl -LsSf https://astral.sh/uv/install.sh | sh
40-
echo "$HOME/.local/bin" >> $GITHUB_PATH
41-
42-
- name: 📦 Install Dependencies
43-
run: uv sync --frozen --extra dev
44-
45-
- name: 🧹 Lint Code
46-
run: uv run flake8 -v --count --show-source --statistics
15+
uses: ./.github/workflows/lint.yml
4716

48-
- name: 🏗️ Build Wheel
49-
run: uv run python -m build --wheel --no-isolation
50-
51-
- name: 🧪 Test Wheel Installation
52-
run: |
53-
uv pip install --system dist/lightnovel_crawler*.whl
54-
lncrawl -ll sources list
55-
lncrawl -lll crawl 'https://novelfull.com/the-kings-avatar-for-the-glory.html' --first 2 --format epub --noin
17+
build-docker:
18+
needs: validate
19+
uses: ./.github/workflows/build-docker.yml
5620

5721
build-windows:
22+
name: Build & Publish (Windows)
5823
needs: validate
59-
name: Build Windows Executable
6024
runs-on: windows-latest
6125
permissions:
6226
contents: write
6327

6428
steps:
65-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v6
30+
with:
31+
fetch-depth: 0
32+
submodules: recursive
33+
34+
- name: 🔄 Update submodules
35+
run: |
36+
git submodule sync
37+
git submodule update --init --remote --merge
6638
6739
- name: 🧰 Install OpenSSL
6840
run: choco install -y --no-progress openssl
6941

7042
- name: 🐍 Set up Python 3.10
71-
uses: actions/setup-python@v5
43+
uses: actions/setup-python@v6
7244
with:
7345
python-version: "3.10"
7446

75-
- name: 🏗️ Build Windows Executable
76-
env:
77-
PYTHONIOENCODING: utf-8
78-
run: .\scripts\build.bat
79-
80-
- name: 🧪 Test Executable
47+
- name: 🏗️ Build Executable
8148
env:
8249
PYTHONIOENCODING: utf-8
83-
run: .\dist\lncrawl.exe -ll sources list
50+
run: |
51+
.\scripts\build.bat
52+
.\dist\lncrawl.exe -ll sources list
8453
8554
- name: 📦 Upload Artifact
86-
uses: actions/upload-artifact@v4
55+
uses: actions/upload-artifact@v7
8756
with:
8857
name: lncrawl-windows
8958
path: dist/lncrawl.exe
@@ -98,30 +67,36 @@ jobs:
9867
token: ${{ secrets.GITHUB_TOKEN }}
9968

10069
build-mac:
70+
name: Build & Publish (MacOS)
10171
needs: validate
102-
name: Build MacOS Executable
10372
runs-on: macos-latest
10473
permissions:
10574
contents: write
10675

10776
steps:
108-
- uses: actions/checkout@v4
77+
- uses: actions/checkout@v6
78+
with:
79+
fetch-depth: 0
80+
submodules: recursive
81+
82+
- name: 🔄 Update submodules
83+
run: |
84+
git submodule sync
85+
git submodule update --init --remote --merge
10986
11087
- name: 🐍 Set up Python 3.10
111-
uses: actions/setup-python@v5
88+
uses: actions/setup-python@v6
11289
with:
11390
python-version: "3.10"
11491

115-
- name: 🏗️ Build MacOS Executable
92+
- name: 🏗️ Build Executable
11693
run: |
11794
sh ./scripts/build.sh
11895
mv ./dist/lncrawl ./dist/lncrawl-mac
119-
120-
- name: 🧪 Test Executable
121-
run: ./dist/lncrawl-mac -ll sources list
96+
./dist/lncrawl-mac -ll sources list
12297
12398
- name: 📦 Upload Artifact
124-
uses: actions/upload-artifact@v4
99+
uses: actions/upload-artifact@v7
125100
with:
126101
name: lncrawl-mac
127102
path: dist/lncrawl-mac
@@ -136,31 +111,37 @@ jobs:
136111
token: ${{ secrets.GITHUB_TOKEN }}
137112

138113
build-linux:
114+
name: Build & Publish (Linux)
139115
needs: validate
140-
name: Build & Publish Linux
141116
runs-on: ubuntu-latest
142117
permissions:
143118
contents: write
144119

145120
steps:
146-
- uses: actions/checkout@v4
121+
- uses: actions/checkout@v6
122+
with:
123+
fetch-depth: 0
124+
submodules: recursive
125+
126+
- name: 🔄 Update submodules
127+
run: |
128+
git submodule sync
129+
git submodule update --init --remote --merge
147130
148131
- name: 🐍 Set up Python 3.10
149-
uses: actions/setup-python@v5
132+
uses: actions/setup-python@v6
150133
with:
151134
python-version: "3.10"
152135
cache: pip
153136

154-
- name: 🏗️ Build Linux Executable
137+
- name: 🏗️ Build Executable
155138
run: |
156139
sh ./scripts/build.sh
157140
mv ./dist/lncrawl ./dist/lncrawl-linux
158-
159-
- name: 🧪 Test Executable
160-
run: ./dist/lncrawl-linux -ll sources list
141+
./dist/lncrawl-linux -ll sources list
161142
162143
- name: 📦 Upload Artifacts
163-
uses: actions/upload-artifact@v4
144+
uses: actions/upload-artifact@v7
164145
with:
165146
name: lncrawl-linux
166147
path: |
@@ -187,63 +168,3 @@ jobs:
187168
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
188169
TWINE_NON_INTERACTIVE: true
189170
run: sh ./scripts/publish.sh
190-
191-
build-docker:
192-
# NOTE: Forks must run the "Build Base Image" workflow (docker-base.yml) first
193-
# to create ghcr.io/<owner>/lncrawl-base:latest before this job can succeed.
194-
needs: [validate]
195-
name: Build & Publish Docker
196-
runs-on: ubuntu-latest
197-
198-
permissions:
199-
contents: read
200-
packages: write # required for GHCR pushes
201-
202-
env:
203-
REGISTRY: ghcr.io
204-
IMAGE_NAME: ghcr.io/${{ github.repository }}
205-
BASE_IMAGE: ghcr.io/${{ github.repository_owner }}/lncrawl-base:latest
206-
207-
steps:
208-
- name: 📥 Checkout
209-
uses: actions/checkout@v4
210-
211-
- name: 🔧 Set lowercase image name
212-
run: |
213-
echo "IMAGE_NAME=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
214-
echo "BASE_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/lncrawl-base:latest" >> $GITHUB_ENV
215-
216-
- name: 🏗️ Set up QEMU
217-
uses: docker/setup-qemu-action@v3
218-
219-
- name: 🐳 Set up Docker Buildx
220-
uses: docker/setup-buildx-action@v3
221-
222-
- name: 🔐 Login to GHCR
223-
uses: docker/login-action@v3
224-
with:
225-
registry: ${{ env.REGISTRY }}
226-
username: ${{ github.actor }}
227-
password: ${{ secrets.GITHUB_TOKEN }}
228-
229-
- name: 🏷️ Read package version
230-
id: package_version
231-
run: echo "version=$(head -n 1 lncrawl/VERSION)" >> "$GITHUB_OUTPUT"
232-
233-
- name: 🏗️ Build and Push Image
234-
uses: docker/build-push-action@v6
235-
with:
236-
context: .
237-
platforms: linux/amd64,linux/arm64
238-
push: true
239-
build-args: |
240-
BASE_IMAGE=${{ env.BASE_IMAGE }}
241-
tags: |
242-
${{ env.IMAGE_NAME }}:latest
243-
${{ env.IMAGE_NAME }}:${{ github.sha }}
244-
${{ env.IMAGE_NAME }}:${{ steps.package_version.outputs.version }}
245-
labels: |
246-
org.opencontainers.image.source=${{ github.event.repository.html_url }}
247-
org.opencontainers.image.revision=${{ github.sha }}
248-
cache-from: type=gha
249-
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)