update the workflow
Build Overleaf Release / build-and-release (push) Successful in 5s
Details
Build Overleaf Release / build-and-release (push) Successful in 5s
Details
This commit is contained in:
parent
a118ea5c94
commit
e3b82c6509
|
|
@ -9,8 +9,11 @@ jobs:
|
||||||
build-and-release:
|
build-and-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code (Intranet Workaround)
|
||||||
uses: actions/checkout@v3
|
run: |
|
||||||
|
# Bypass external GitHub Actions by manually cloning from the local Gitea instance
|
||||||
|
git clone https://oauth2:${{ secrets.GITHUB_TOKEN }}@git.amirkabirpark.ir/${{ gitea.repository }}.git .
|
||||||
|
git checkout ${{ gitea.ref_name }}
|
||||||
|
|
||||||
- name: Create Clean ZIP for Overleaf
|
- name: Create Clean ZIP for Overleaf
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -18,8 +21,25 @@ jobs:
|
||||||
# Exclude the .git folder and any github/gitea workflow files
|
# Exclude the .git folder and any github/gitea workflow files
|
||||||
zip -r Overleaf_Park__ReportTemplate-${{ gitea.ref_name }}.zip . -x "*.git*" -x "*.gitea*"
|
zip -r Overleaf_Park__ReportTemplate-${{ gitea.ref_name }}.zip . -x "*.git*" -x "*.gitea*"
|
||||||
|
|
||||||
- name: Upload to Gitea Release
|
- name: Upload to Gitea Release (Intranet Workaround)
|
||||||
uses: https://gitea.com/actions/release-action@main
|
run: |
|
||||||
with:
|
ZIP_NAME="Overleaf_Park__ReportTemplate-${{ gitea.ref_name }}.zip"
|
||||||
files: Overleaf_Park__ReportTemplate-${{ gitea.ref_name }}.zip
|
API_BASE="https://git.amirkabirpark.ir/api/v1/repos/${{ gitea.repository }}"
|
||||||
api_key: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
# 1. Fetch the Release ID associated with this tag using Gitea's local API
|
||||||
|
RELEASE_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$API_BASE/releases/tags/${{ gitea.ref_name }}")
|
||||||
|
RELEASE_ID=$(echo "$RELEASE_DATA" | jq -r '.id')
|
||||||
|
|
||||||
|
# 2. If a release record doesn't exist yet, create an empty one
|
||||||
|
if [ "$RELEASE_ID" == "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||||
|
CREATE_DATA=$(curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\": \"${{ gitea.ref_name }}\", \"name\": \"${{ gitea.ref_name }}\"}" \
|
||||||
|
"$API_BASE/releases")
|
||||||
|
RELEASE_ID=$(echo "$CREATE_DATA" | jq -r '.id')
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Upload the ZIP artifact directly to the release attachment endpoint
|
||||||
|
curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
-F "attachment=@$ZIP_NAME" \
|
||||||
|
"$API_BASE/releases/$RELEASE_ID/assets?name=$ZIP_NAME"
|
||||||
Loading…
Reference in New Issue