This commit is contained in:
@@ -8,11 +8,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
GITEA_URL: https://10.1.1.1:8086
|
|
||||||
GITEA_OWNER: derek
|
|
||||||
GITEA_REPO: ${{ gitea.repository }}
|
|
||||||
GITEA_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -35,47 +30,11 @@ jobs:
|
|||||||
- name: export server
|
- name: export server
|
||||||
run: docker save mistox-website -o release/mistox-website.tar
|
run: docker save mistox-website -o release/mistox-website.tar
|
||||||
|
|
||||||
- name: publish release
|
- name: release
|
||||||
run: |
|
image: appleboy/drone-gitea-release
|
||||||
TAG_NAME="v1.0.${GITHUB_RUN_NUMBER}"
|
settings:
|
||||||
RELEASE_TITLE="Release $(date +%d-%m-%Y)"
|
api_key: ${{ secrets.PUBLISH_TOKEN }}
|
||||||
DESCRIPTION="Automated release from CI run $GITHUB_RUN_NUMBER"
|
base_url: http://10.1.1.1:8086
|
||||||
|
files: release
|
||||||
RELEASE_JSON="{\"tag_name\":\"$(date +%d-%m-%Y)\",\"title\":\"$(date +%d-%m-%Y)\",\"draft\":false,\"prerelease\":false}"
|
checksum: sha256
|
||||||
|
tag: $(date +%d-%m-%Y)
|
||||||
echo "Creating release $(date +%d-%m-%Y) on Gitea..."
|
|
||||||
|
|
||||||
RESPONSE=$(curl -s -X POST \
|
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "$RELEASE_JSON" \
|
|
||||||
"$GITEA_URL/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases")
|
|
||||||
|
|
||||||
RELEASE_ID=$(echo "$RESPONSE" | grep -oP '"id":\s*\K[0-9]+')
|
|
||||||
|
|
||||||
if [ -z "$RELEASE_ID" ]; then
|
|
||||||
echo "Failed to create release. Response:"
|
|
||||||
echo "$RESPONSE"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Release created with ID $RELEASE_ID"
|
|
||||||
|
|
||||||
for asset in release/mistox-sql.tar release/mistox-website.tar; do
|
|
||||||
FILENAME=$(basename "$asset")
|
|
||||||
echo "Uploading $FILENAME..."
|
|
||||||
|
|
||||||
UPLOAD_RESPONSE=$(curl -s -X POST \
|
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
|
||||||
-F "name=$FILENAME" \
|
|
||||||
-F "attachment=@$asset" \
|
|
||||||
"$GITEA_URL/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases/$RELEASE_ID/assets")
|
|
||||||
|
|
||||||
if echo "$UPLOAD_RESPONSE" | grep -q '"id":'; then
|
|
||||||
echo "Uploaded $FILENAME successfully."
|
|
||||||
else
|
|
||||||
echo "Failed to upload $FILENAME. Response:"
|
|
||||||
echo "$UPLOAD_RESPONSE"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|||||||
Reference in New Issue
Block a user