Files
firefox-containerbookmarks/.gitea/workflows/build.yaml
Elmar Kresse ccc4ace7c4
Some checks failed
Build Firefox Extension / build (push) Failing after 5s
Build Firefox Extension / release (push) Has been skipped
feat: add Gitea Actions workflow to build, package, upload, and release the Firefox extension.
2026-01-20 01:21:01 +01:00

101 lines
3.1 KiB
YAML

name: Build Firefox Extension
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
build:
runs-on: docker
permissions:
contents: read
packages: write
container:
image: node:20-alpine
steps:
- name: Install dependencies
run: apk add --no-cache zip jq git curl
- name: Checkout repository
uses: actions/checkout@v3
- name: Get version from manifest
id: version
run: |
VERSION=$(jq -r '.version' manifest.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Create extension package
run: |
# Create build directory
mkdir -p build
# Package the extension as XPI (which is just a ZIP file)
zip -r build/container-bookmarks-${{ steps.version.outputs.version }}.xpi \
manifest.json \
background.js \
icons/ \
popup/ \
README.md \
-x "*.git*" \
-x "*.md" \
-x "build/*" \
-x "node_modules/*" \
-x ".gitea/*"
# Also create a ZIP for convenience
cp build/container-bookmarks-${{ steps.version.outputs.version }}.xpi \
build/container-bookmarks-${{ steps.version.outputs.version }}.zip
- name: Upload to Gitea Packages
run: |
echo "Server URL: ${GITHUB_SERVER_URL}"
echo "Repository Owner: ${GITHUB_REPOSITORY_OWNER}"
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"
echo "Package URL: ${PACKAGE_URL}"
curl --fail -v \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
--upload-file "build/container-bookmarks-${{ steps.version.outputs.version }}.xpi" \
"${PACKAGE_URL}"
release:
runs-on: docker
container:
image: node:20-alpine
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Install dependencies
run: apk add --no-cache jq git curl
- name: Checkout repository
uses: actions/checkout@v3
- name: Get version from manifest
id: version
run: |
VERSION=$(jq -r '.version' manifest.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download from Gitea Packages
run: |
mkdir -p build
curl --fail -o "build/container-bookmarks-${{ 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"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: build/*.xpi
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}