ci: Add Gitea workflow to build, package, upload to Gitea Packages, and create a release for the Firefox extension.
This commit is contained in:
@@ -38,7 +38,7 @@ jobs:
|
|||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
|
||||||
# Package the extension as XPI (which is just a ZIP file)
|
# Package the extension as XPI (which is just a ZIP file)
|
||||||
zip -r build/container-bookmarks-${{ steps.version.outputs.version }}.xpi \
|
zip -r build/firefox-containerbookmarks-${{ steps.version.outputs.version }}.xpi \
|
||||||
manifest.json \
|
manifest.json \
|
||||||
background.js \
|
background.js \
|
||||||
icons/ \
|
icons/ \
|
||||||
@@ -51,20 +51,33 @@ jobs:
|
|||||||
-x ".gitea/*"
|
-x ".gitea/*"
|
||||||
|
|
||||||
# Also create a ZIP for convenience
|
# Also create a ZIP for convenience
|
||||||
cp build/container-bookmarks-${{ steps.version.outputs.version }}.xpi \
|
cp build/firefox-containerbookmarks-${{ steps.version.outputs.version }}.xpi \
|
||||||
build/container-bookmarks-${{ steps.version.outputs.version }}.zip
|
build/firefox-containerbookmarks-${{ steps.version.outputs.version }}.zip
|
||||||
|
|
||||||
- name: Upload to Gitea Packages
|
- name: Upload to Gitea Packages
|
||||||
run: |
|
run: |
|
||||||
echo "Server URL: ${GITHUB_SERVER_URL}"
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
echo "Repository Owner: ${GITHUB_REPOSITORY_OWNER}"
|
PACKAGE_URL="${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/firefox-containerbookmarks/${VERSION}/firefox-containerbookmarks-${VERSION}.xpi"
|
||||||
echo "Repository: ${GITHUB_REPOSITORY}"
|
|
||||||
PACKAGE_URL="${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/container-bookmarks/${{ steps.version.outputs.version }}/container-bookmarks-${{ steps.version.outputs.version }}.xpi"
|
# Try to upload, if 409 (already exists) try to delete and re-upload
|
||||||
echo "Package URL: ${PACKAGE_URL}"
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
curl --fail -v \
|
|
||||||
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
|
||||||
--upload-file "build/container-bookmarks-${{ steps.version.outputs.version }}.xpi" \
|
--upload-file "build/firefox-containerbookmarks-${VERSION}.xpi" \
|
||||||
|
"${PACKAGE_URL}")
|
||||||
|
|
||||||
|
if [ "$HTTP_CODE" = "409" ]; then
|
||||||
|
echo "Package already exists, deleting and re-uploading..."
|
||||||
|
curl -X DELETE -H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" "${PACKAGE_URL}"
|
||||||
|
curl --fail \
|
||||||
|
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
|
||||||
|
--upload-file "build/firefox-containerbookmarks-${VERSION}.xpi" \
|
||||||
"${PACKAGE_URL}"
|
"${PACKAGE_URL}"
|
||||||
|
elif [ "$HTTP_CODE" != "201" ] && [ "$HTTP_CODE" != "200" ]; then
|
||||||
|
echo "Upload failed with HTTP code: $HTTP_CODE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ Package uploaded successfully: ${PACKAGE_URL}"
|
||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
@@ -88,8 +101,8 @@ jobs:
|
|||||||
- name: Download from Gitea Packages
|
- name: Download from Gitea Packages
|
||||||
run: |
|
run: |
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
curl --fail -o "build/container-bookmarks-${{ steps.version.outputs.version }}.xpi" \
|
curl --fail -o "build/firefox-containerbookmarks-${{ steps.version.outputs.version }}.xpi" \
|
||||||
"${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/container-bookmarks/${{ steps.version.outputs.version }}/container-bookmarks-${{ steps.version.outputs.version }}.xpi"
|
"${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/generic/firefox-containerbookmarks/${{ steps.version.outputs.version }}/firefox-containerbookmarks-${{ steps.version.outputs.version }}.xpi"
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
Reference in New Issue
Block a user