feat: автообновление бинаря из Gitea Packages (/update, /status, авто-уведомление)
All checks were successful
CI / test (push) Successful in 47s
CI / build-and-package (amd64, darwin) (push) Successful in 40s
CI / build-and-package (amd64, linux) (push) Successful in 40s
CI / build-and-package (amd64, windows) (push) Successful in 39s
CI / build-and-package (arm64, darwin) (push) Successful in 40s
CI / build-and-package (arm64, linux) (push) Successful in 40s
All checks were successful
CI / test (push) Successful in 47s
CI / build-and-package (amd64, darwin) (push) Successful in 40s
CI / build-and-package (amd64, linux) (push) Successful in 40s
CI / build-and-package (amd64, windows) (push) Successful in 39s
CI / build-and-package (arm64, darwin) (push) Successful in 40s
CI / build-and-package (arm64, linux) (push) Successful in 40s
This commit is contained in:
@@ -56,9 +56,11 @@ jobs:
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||
FILENAME="${FILENAME}.exe"
|
||||
fi
|
||||
VERSION="commit-$(echo '${{ gitea.sha }}' | cut -c1-7)"
|
||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \
|
||||
go build -ldflags="-s -w" -o "${FILENAME}" ./cmd/ratatoskr/
|
||||
go build -ldflags="-s -w -X main.version=${VERSION}" -o "${FILENAME}" ./cmd/ratatoskr/
|
||||
echo "FILENAME=${FILENAME}" >> "${GITEA_ENV}"
|
||||
echo "VERSION=${VERSION}" >> "${GITEA_ENV}"
|
||||
|
||||
- name: Show size
|
||||
run: ls -lh "$FILENAME"
|
||||
@@ -66,7 +68,6 @@ jobs:
|
||||
- name: Upload to Gitea Packages
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
run: |
|
||||
VERSION="commit-$(echo '${{ gitea.sha }}' | cut -c1-7)"
|
||||
curl -sS -X PUT \
|
||||
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
@@ -82,4 +83,24 @@ jobs:
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/${FILENAME}" \
|
||||
--data-binary @${FILENAME}
|
||||
echo "Updated 'latest/${FILENAME}'"
|
||||
echo "Updated 'latest/${FILENAME}'"
|
||||
|
||||
- name: Publish companion files (version + sha256)
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
run: |
|
||||
SHA256_HEX=$(sha256sum "${FILENAME}" | awk '{print $1}')
|
||||
# <filename>.version — идентификатор версии для авто-обновления
|
||||
printf '%s' "${VERSION}" > "${FILENAME}.version"
|
||||
# <filename>.sha256 — контрольная сумма бинаря (проверка U4)
|
||||
printf '%s' "${SHA256_HEX}" > "${FILENAME}.sha256"
|
||||
curl -sS -X PUT \
|
||||
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: text/plain" \
|
||||
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/${FILENAME}.version" \
|
||||
--data-binary @${FILENAME}.version
|
||||
curl -sS -X PUT \
|
||||
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: text/plain" \
|
||||
"${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/${FILENAME}.sha256" \
|
||||
--data-binary @${FILENAME}.sha256
|
||||
echo "Published companion files for latest/${FILENAME}"
|
||||
Reference in New Issue
Block a user