Merge pull request 'develop' (#7) from develop into main
Release / build (map[cmake_extra: name:linux-amd64 toolchain:]) (push) Failing after 6s
Release / build (map[cmake_extra: name:linux-arm64 toolchain:-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-arm64.cmake]) (push) Failing after 6s
Release / build (map[cmake_extra: name:linux-armhf toolchain:-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-armhf.cmake]) (push) Failing after 7s
Release / build (map[cmake_extra:-DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED=OFF name:baremetal-arm32 toolchain:-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-baremetal-arm32.cmake]) (push) Failing after 6s
Release / build (map[cmake_extra:-DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF name:windows-amd64 toolchain:-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-windows-amd64.cmake]) (push) Failing after 6s
Release / release (push) Has been skipped
Release / build (map[cmake_extra: name:linux-amd64 toolchain:]) (push) Failing after 6s
Release / build (map[cmake_extra: name:linux-arm64 toolchain:-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-arm64.cmake]) (push) Failing after 6s
Release / build (map[cmake_extra: name:linux-armhf toolchain:-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-armhf.cmake]) (push) Failing after 7s
Release / build (map[cmake_extra:-DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED=OFF name:baremetal-arm32 toolchain:-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-baremetal-arm32.cmake]) (push) Failing after 6s
Release / build (map[cmake_extra:-DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF name:windows-amd64 toolchain:-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-windows-amd64.cmake]) (push) Failing after 6s
Release / release (push) Has been skipped
Reviewed-on: #7
This commit was merged in pull request #7.
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
@@ -53,13 +52,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
PKG="datarouter-${{ matrix.target.name }}"
|
PKG="datarouter-${{ matrix.target.name }}"
|
||||||
mkdir -p "dist/$PKG"
|
mkdir -p "dist/$PKG"
|
||||||
cp datarouter.h datarouter_config_template.h LICENSE README.md "dist/$PKG/"
|
cp datarouter.h datarouter_config_template.h LICENSE "dist/$PKG/"
|
||||||
cp build/libDataRouter.a "dist/$PKG/" 2>/dev/null || true
|
[ -f README.md ] && cp README.md "dist/$PKG/"
|
||||||
cp build/libDataRouter.so "dist/$PKG/" 2>/dev/null || true
|
for f in libDataRouter.a libDataRouter.so libDataRouter.dll libDataRouter.dll.a example example.exe; do
|
||||||
cp build/libDataRouter.dll "dist/$PKG/" 2>/dev/null || true
|
[ -f "build/$f" ] && cp "build/$f" "dist/$PKG/"
|
||||||
cp build/libDataRouter.dll.a "dist/$PKG/" 2>/dev/null || true
|
done
|
||||||
cp build/example "dist/$PKG/" 2>/dev/null || true
|
|
||||||
cp build/example.exe "dist/$PKG/" 2>/dev/null || true
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -68,9 +65,7 @@ jobs:
|
|||||||
|
|
||||||
release:
|
release:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-builder
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -79,50 +74,40 @@ jobs:
|
|||||||
- name: Verify merge commit
|
- name: Verify merge commit
|
||||||
run: |
|
run: |
|
||||||
PARENTS=$(git log --format="%P" -1 | wc -w)
|
PARENTS=$(git log --format="%P" -1 | wc -w)
|
||||||
if [ "$PARENTS" -lt 2 ]; then
|
[ "$PARENTS" -ge 2 ] || exit 78
|
||||||
echo "Not a merge commit. Skipping release."
|
|
||||||
exit 78
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Read tag from HEAD
|
- name: Read tag from HEAD
|
||||||
id: tag
|
id: tag
|
||||||
run: |
|
run: |
|
||||||
TAG=$(git tag --points-at HEAD | grep '^v' | head -n1)
|
TAG=$(git tag --points-at HEAD | grep '^v' | head -n1)
|
||||||
if [ -z "$TAG" ]; then
|
[ -n "$TAG" ] || exit 78
|
||||||
echo "No v* tag on HEAD. Create a tag manually, then merge."
|
|
||||||
exit 78
|
|
||||||
fi
|
|
||||||
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
|
|
||||||
- name: Create release & upload assets via Gitea API
|
- name: Create release & upload assets
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.tag.outputs.tag }}"
|
TAG="${{ steps.tag.outputs.tag }}"
|
||||||
SERVER="${GITHUB_SERVER_URL:-https://git.7iwind.cn}"
|
API="${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases"
|
||||||
GITEA_API="${SERVER}/api/v1/repos/${GITHUB_REPOSITORY}/releases"
|
|
||||||
|
|
||||||
echo "=== Create release for tag ${TAG} ==="
|
echo "=== Creating release $TAG ==="
|
||||||
RESP=$(curl -s -X POST \
|
RESP=$(curl -s -X POST \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${{ gitea.token }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"DataRouter ${TAG}\",\"body\":\"## DataRouter ${TAG}\\n\\n合并 develop → main 后自动构建发布。\"}" \
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"DataRouter ${TAG}\"}" \
|
||||||
"${GITEA_API}")
|
"$API")
|
||||||
|
|
||||||
ID=$(echo "$RESP" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
|
ID=$(echo "$RESP" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
|
||||||
echo "Release ID: ${ID}"
|
|
||||||
|
|
||||||
for dir in artifacts/*/; do
|
for dir in artifacts/*/; do
|
||||||
name="$(basename "$dir").tar.gz"
|
name="$(basename "$dir").tar.gz"
|
||||||
tar czf "/tmp/${name}" -C "$dir" .
|
tar czf "/tmp/$name" -C "$dir" .
|
||||||
echo "Uploading ${name} ..."
|
echo "Uploading $name"
|
||||||
curl -s -X POST \
|
curl -s -X POST \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${{ gitea.token }}" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary @"/tmp/${name}" \
|
--data-binary @"/tmp/$name" \
|
||||||
"${GITEA_API}/${ID}/assets?name=${name}"
|
"${API}/${ID}/assets?name=${name}"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user