ci: 修复并优化 ci 流程 (#269)
This commit is contained in:
15
.github/workflows/build-binary.yaml
vendored
15
.github/workflows/build-binary.yaml
vendored
@@ -26,8 +26,13 @@ jobs:
|
||||
key: ${{ runner.os }}-bun-${{ hashFiles('docs/bun.lockb') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-bun-
|
||||
- name: Build documentation
|
||||
- name: Build Frontend
|
||||
run: bun run build
|
||||
- name: Upload Web Build Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: web-build
|
||||
path: web/build
|
||||
build:
|
||||
name: Build bili-sync-rs for ${{ matrix.platform.release_for }}
|
||||
needs: build-frontend
|
||||
@@ -63,6 +68,11 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
- name: Download Web Build Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: web-build
|
||||
path: web/build
|
||||
- name: Cache dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
- name: Install musl-tools
|
||||
@@ -79,7 +89,6 @@ jobs:
|
||||
- name: Package as archive
|
||||
shell: bash
|
||||
run: |
|
||||
cp target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} ${{ matrix.platform.release_for }}-${{ matrix.platform.bin }}
|
||||
cd target/${{ matrix.platform.target }}/release
|
||||
if [[ "${{ matrix.platform.target }}" == "x86_64-pc-windows-msvc" ]]; then
|
||||
7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
|
||||
@@ -90,7 +99,5 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bili-sync-rs-${{ matrix.platform.release_for }}
|
||||
# contains raw binary and compressed archive
|
||||
path: |
|
||||
${{ github.workspace }}/${{ matrix.platform.release_for }}-${{ matrix.platform.bin }}
|
||||
${{ github.workspace }}/${{ matrix.platform.name }}
|
||||
|
||||
@@ -9,12 +9,12 @@ RUN apk update && apk add --no-cache \
|
||||
tzdata \
|
||||
ffmpeg
|
||||
|
||||
COPY ./*-bili-sync-rs ./targets/
|
||||
COPY ./bili-sync-rs-Linux-*.tar.gz ./targets/
|
||||
|
||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||
mv ./targets/Linux-x86_64-bili-sync-rs ./bili-sync-rs; \
|
||||
tar xzvf ./targets/bili-sync-rs-Linux-x86_64-musl.tar.gz -C ./; \
|
||||
else \
|
||||
mv ./targets/Linux-aarch64-bili-sync-rs ./bili-sync-rs; \
|
||||
tar xzvf ./targets/bili-sync-rs-Linux-aarch64-musl.tar.gz -C ./; \
|
||||
fi
|
||||
|
||||
RUN rm -rf ./targets && chmod +x ./bili-sync-rs
|
||||
|
||||
23
Justfile
23
Justfile
@@ -1,17 +1,24 @@
|
||||
clean:
|
||||
rm -rf ./*-bili-sync-rs
|
||||
rm -rf ./bili-sync-rs-Linux*.tar.gz
|
||||
|
||||
build:
|
||||
build-frontend:
|
||||
cd ./web && bun run build && cd ..
|
||||
|
||||
build: build-frontend
|
||||
cargo build --target x86_64-unknown-linux-musl --release
|
||||
|
||||
build-debug: build-frontend
|
||||
cargo build --target x86_64-unknown-linux-musl
|
||||
|
||||
build-docker: build
|
||||
cp target/x86_64-unknown-linux-musl/release/bili-sync-rs ./Linux-x86_64-bili-sync-rs
|
||||
tar czvf ./bili-sync-rs-Linux-x86_64-musl.tar.gz -C ./target/x86_64-unknown-linux-musl/release/ ./bili-sync-rs
|
||||
docker build . -t bili-sync-rs-local --build-arg="TARGETPLATFORM=linux/amd64"
|
||||
just clean
|
||||
|
||||
run:
|
||||
cd ./web && bun run build && cd ..
|
||||
cargo run
|
||||
build-docker-debug: build-debug
|
||||
tar czvf ./bili-sync-rs-Linux-x86_64-musl.tar.gz -C ./target/x86_64-unknown-linux-musl/debug/ ./bili-sync-rs
|
||||
docker build . -t bili-sync-rs-local --build-arg="TARGETPLATFORM=linux/amd64"
|
||||
just clean
|
||||
|
||||
debug:
|
||||
just run
|
||||
debug: build-frontend
|
||||
cargo run
|
||||
|
||||
Reference in New Issue
Block a user