Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db6ca3c232 |
@@ -8,6 +8,10 @@ on:
|
|||||||
- "v*"
|
- "v*"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
releases: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -38,26 +42,9 @@ jobs:
|
|||||||
ls -la dist-release
|
ls -la dist-release
|
||||||
|
|
||||||
- name: Create release and upload assets
|
- name: Create release and upload assets
|
||||||
env:
|
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
with:
|
||||||
run: |
|
tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('build-{0}', github.run_number) }}
|
||||||
set -eu
|
target_commitish: ${{ github.sha }}
|
||||||
[ -n "${TOKEN}" ] || { echo "ERROR: no token available (secrets.GITHUB_TOKEN is empty)"; exit 1; }
|
files: |-
|
||||||
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
dist-release/*
|
||||||
if [ "${GITHUB_REF_TYPE:-}" = "tag" ]; then
|
|
||||||
TAG="${GITHUB_REF_NAME}"
|
|
||||||
else
|
|
||||||
TAG="build-${GITHUB_RUN_NUMBER}"
|
|
||||||
fi
|
|
||||||
echo "Creating release ${TAG} on ${API}"
|
|
||||||
curl -sS --fail-with-body -X POST "$API/releases" \
|
|
||||||
-H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" \
|
|
||||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"target_commitish\":\"${GITHUB_SHA}\"}" \
|
|
||||||
-o release.json
|
|
||||||
RELEASE_ID=$(sed -n 's/.*"id":\([0-9]*\).*/\1/p' release.json | head -1)
|
|
||||||
echo "Release id: ${RELEASE_ID}"
|
|
||||||
for f in dist-release/*; do
|
|
||||||
echo "Uploading $f"
|
|
||||||
curl -sS --fail-with-body -X POST "$API/releases/${RELEASE_ID}/assets?name=$(basename "$f")" \
|
|
||||||
-H "Authorization: token ${TOKEN}" -F "attachment=@${f}"
|
|
||||||
done
|
|
||||||
Reference in new issue
Block a user