ci: fix checkout — replace actions/checkout@v4 with direct git clone
actions/checkout@v4 requires Node.js which is not in rust:1.88-slim. Replace with direct git init+fetch+checkout using the Gitea instance URL. Also fix release.yml: each build job creates the release (idempotent) and uploads its own artifacts inline via Gitea API. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0b566d8e92
commit
29b6fb2170
@ -11,7 +11,13 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: rust:1.88-slim
|
image: rust:1.88-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
apt-get install -y -qq git
|
||||||
|
git init
|
||||||
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
||||||
|
git fetch --depth=1 origin $GITHUB_SHA
|
||||||
|
git checkout FETCH_HEAD
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq && apt-get install -y -qq \
|
apt-get update -qq && apt-get install -y -qq \
|
||||||
@ -26,23 +32,39 @@ jobs:
|
|||||||
rustup target add x86_64-unknown-linux-gnu
|
rustup target add x86_64-unknown-linux-gnu
|
||||||
cargo install tauri-cli --version "^2" --locked
|
cargo install tauri-cli --version "^2" --locked
|
||||||
CI=true cargo tauri build --target x86_64-unknown-linux-gnu
|
CI=true cargo tauri build --target x86_64-unknown-linux-gnu
|
||||||
- name: Collect artifacts
|
- name: Upload artifacts
|
||||||
|
env:
|
||||||
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p artifacts
|
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
|
||||||
|
TAG="$GITHUB_REF_NAME"
|
||||||
|
# Create release (idempotent)
|
||||||
|
curl -sf -X POST "$API/releases" \
|
||||||
|
-H "Authorization: token $RELEASE_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true
|
||||||
|
RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \
|
||||||
|
-H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
echo "Release ID: $RELEASE_ID"
|
||||||
find src-tauri/target/x86_64-unknown-linux-gnu/release/bundle \
|
find src-tauri/target/x86_64-unknown-linux-gnu/release/bundle \
|
||||||
\( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) \
|
\( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) | while read f; do
|
||||||
-exec cp {} artifacts/ \;
|
curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \
|
||||||
- uses: actions/upload-artifact@v4
|
-H "Authorization: token $RELEASE_TOKEN" \
|
||||||
with:
|
-F "attachment=@$f;filename=$(basename $f)" && echo "Uploaded $(basename $f)" || echo "Upload failed: $f"
|
||||||
name: linux-amd64
|
done
|
||||||
path: artifacts/
|
|
||||||
|
|
||||||
build-windows-amd64:
|
build-windows-amd64:
|
||||||
runs-on: linux-amd64
|
runs-on: linux-amd64
|
||||||
container:
|
container:
|
||||||
image: rust:1.88-slim
|
image: rust:1.88-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
apt-get install -y -qq git
|
||||||
|
git init
|
||||||
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
||||||
|
git fetch --depth=1 origin $GITHUB_SHA
|
||||||
|
git checkout FETCH_HEAD
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq && apt-get install -y -qq mingw-w64 curl nsis perl make
|
apt-get update -qq && apt-get install -y -qq mingw-w64 curl nsis perl make
|
||||||
@ -59,23 +81,37 @@ jobs:
|
|||||||
rustup target add x86_64-pc-windows-gnu
|
rustup target add x86_64-pc-windows-gnu
|
||||||
cargo install tauri-cli --version "^2" --locked
|
cargo install tauri-cli --version "^2" --locked
|
||||||
CI=true cargo tauri build --target x86_64-pc-windows-gnu
|
CI=true cargo tauri build --target x86_64-pc-windows-gnu
|
||||||
- name: Collect artifacts
|
- name: Upload artifacts
|
||||||
|
env:
|
||||||
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p artifacts
|
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
|
||||||
|
TAG="$GITHUB_REF_NAME"
|
||||||
|
curl -sf -X POST "$API/releases" \
|
||||||
|
-H "Authorization: token $RELEASE_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true
|
||||||
|
RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \
|
||||||
|
-H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
find src-tauri/target/x86_64-pc-windows-gnu/release/bundle \
|
find src-tauri/target/x86_64-pc-windows-gnu/release/bundle \
|
||||||
\( -name "*.exe" -o -name "*.msi" \) \
|
\( -name "*.exe" -o -name "*.msi" \) 2>/dev/null | while read f; do
|
||||||
-exec cp {} artifacts/ \; 2>/dev/null || true
|
curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \
|
||||||
- uses: actions/upload-artifact@v4
|
-H "Authorization: token $RELEASE_TOKEN" \
|
||||||
with:
|
-F "attachment=@$f;filename=$(basename $f)" && echo "Uploaded $(basename $f)" || echo "Upload failed: $f"
|
||||||
name: windows-amd64
|
done
|
||||||
path: artifacts/
|
|
||||||
|
|
||||||
build-linux-arm64:
|
build-linux-arm64:
|
||||||
runs-on: linux-arm64
|
runs-on: linux-arm64
|
||||||
container:
|
container:
|
||||||
image: rust:1.88-slim
|
image: rust:1.88-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
apt-get install -y -qq git
|
||||||
|
git init
|
||||||
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
||||||
|
git fetch --depth=1 origin $GITHUB_SHA
|
||||||
|
git checkout FETCH_HEAD
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq && apt-get install -y -qq \
|
apt-get update -qq && apt-get install -y -qq \
|
||||||
@ -90,48 +126,21 @@ jobs:
|
|||||||
rustup target add aarch64-unknown-linux-gnu
|
rustup target add aarch64-unknown-linux-gnu
|
||||||
cargo install tauri-cli --version "^2" --locked
|
cargo install tauri-cli --version "^2" --locked
|
||||||
CI=true cargo tauri build --target aarch64-unknown-linux-gnu
|
CI=true cargo tauri build --target aarch64-unknown-linux-gnu
|
||||||
- name: Collect artifacts
|
- name: Upload artifacts
|
||||||
run: |
|
|
||||||
mkdir -p artifacts
|
|
||||||
find src-tauri/target/aarch64-unknown-linux-gnu/release/bundle \
|
|
||||||
\( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) \
|
|
||||||
-exec cp {} artifacts/ \;
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: linux-arm64
|
|
||||||
path: artifacts/
|
|
||||||
|
|
||||||
upload-release:
|
|
||||||
needs: [build-linux-amd64, build-windows-amd64, build-linux-arm64]
|
|
||||||
runs-on: linux-amd64
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: artifacts/
|
|
||||||
|
|
||||||
- name: Create Gitea release and upload artifacts
|
|
||||||
env:
|
env:
|
||||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ gitea.ref_name }}"
|
API="http://172.0.0.29:3000/api/v1/repos/$GITHUB_REPOSITORY"
|
||||||
REPO="${{ gitea.repository }}"
|
TAG="$GITHUB_REF_NAME"
|
||||||
API="http://gitea_app:3000/api/v1"
|
curl -sf -X POST "$API/releases" \
|
||||||
|
|
||||||
# Create release (idempotent)
|
|
||||||
curl -sf -X POST "$API/repos/$REPO/releases" \
|
|
||||||
-H "Authorization: token $RELEASE_TOKEN" \
|
-H "Authorization: token $RELEASE_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"TFTSR $TAG\",\"body\":\"Release $TAG\",\"draft\":false}" || true
|
||||||
|
RELEASE_ID=$(curl -sf "$API/releases/tags/$TAG" \
|
||||||
# Get release ID
|
|
||||||
RELEASE_ID=$(curl -sf "$API/repos/$REPO/releases/tags/$TAG" \
|
|
||||||
-H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
-H "Authorization: token $RELEASE_TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
echo "Release ID: $RELEASE_ID"
|
find src-tauri/target/aarch64-unknown-linux-gnu/release/bundle \
|
||||||
|
\( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) | while read f; do
|
||||||
# Upload all artifacts
|
curl -sf -X POST "$API/releases/$RELEASE_ID/assets" \
|
||||||
find artifacts/ -type f | while read f; do
|
|
||||||
echo "Uploading $f..."
|
|
||||||
curl -sf -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets" \
|
|
||||||
-H "Authorization: token $RELEASE_TOKEN" \
|
-H "Authorization: token $RELEASE_TOKEN" \
|
||||||
-F "attachment=@$f;filename=$(basename $f)" && echo "OK" || echo "Upload failed: $f"
|
-F "attachment=@$f;filename=$(basename $f)" && echo "Uploaded $(basename $f)" || echo "Upload failed: $f"
|
||||||
done
|
done
|
||||||
|
|||||||
@ -8,7 +8,13 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: rust:1.88-slim
|
image: rust:1.88-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
apt-get install -y -qq git
|
||||||
|
git init
|
||||||
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
||||||
|
git fetch --depth=1 origin $GITHUB_SHA
|
||||||
|
git checkout FETCH_HEAD
|
||||||
- run: rustup component add rustfmt
|
- run: rustup component add rustfmt
|
||||||
- run: cargo fmt --manifest-path src-tauri/Cargo.toml --check
|
- run: cargo fmt --manifest-path src-tauri/Cargo.toml --check
|
||||||
|
|
||||||
@ -17,7 +23,13 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: rust:1.88-slim
|
image: rust:1.88-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
apt-get install -y -qq git
|
||||||
|
git init
|
||||||
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
||||||
|
git fetch --depth=1 origin $GITHUB_SHA
|
||||||
|
git checkout FETCH_HEAD
|
||||||
- run: apt-get update -qq && apt-get install -y -qq libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf pkg-config perl
|
- run: apt-get update -qq && apt-get install -y -qq libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf pkg-config perl
|
||||||
- run: rustup component add clippy
|
- run: rustup component add clippy
|
||||||
- run: cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings
|
- run: cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings
|
||||||
@ -27,7 +39,13 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: rust:1.88-slim
|
image: rust:1.88-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
apt-get install -y -qq git
|
||||||
|
git init
|
||||||
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
||||||
|
git fetch --depth=1 origin $GITHUB_SHA
|
||||||
|
git checkout FETCH_HEAD
|
||||||
- run: apt-get update -qq && apt-get install -y -qq libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf pkg-config perl
|
- run: apt-get update -qq && apt-get install -y -qq libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf pkg-config perl
|
||||||
- run: cargo test --manifest-path src-tauri/Cargo.toml
|
- run: cargo test --manifest-path src-tauri/Cargo.toml
|
||||||
|
|
||||||
@ -36,7 +54,13 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: node:22-alpine
|
image: node:22-alpine
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
apk add --no-cache git
|
||||||
|
git init
|
||||||
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
||||||
|
git fetch --depth=1 origin $GITHUB_SHA
|
||||||
|
git checkout FETCH_HEAD
|
||||||
- run: npm ci --legacy-peer-deps
|
- run: npm ci --legacy-peer-deps
|
||||||
- run: npx tsc --noEmit
|
- run: npx tsc --noEmit
|
||||||
|
|
||||||
@ -45,6 +69,12 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: node:22-alpine
|
image: node:22-alpine
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
apk add --no-cache git
|
||||||
|
git init
|
||||||
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
||||||
|
git fetch --depth=1 origin $GITHUB_SHA
|
||||||
|
git checkout FETCH_HEAD
|
||||||
- run: npm ci --legacy-peer-deps
|
- run: npm ci --legacy-peer-deps
|
||||||
- run: npm run test:run
|
- run: npm run test:run
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user