name: Build plugin release on: push: tags: - 'v*' permissions: code: read releases: write jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Validate version and build ZIP env: RELEASE_TAG: ${{ gitea.ref_name }} run: | VERSION="${RELEASE_TAG#v}" grep -q "Version: ${VERSION}$" dabestaniha-authenticate-bridge.php mkdir -p dist git archive \ --format=zip \ --prefix=mahak-authenticate-bridge/ \ --output=dist/mahak-authenticate-bridge.zip \ HEAD - name: Publish Gitea release env: GITEA_API_URL: ${{ gitea.api_url }} GITEA_REPOSITORY: ${{ gitea.repository }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} RELEASE_TAG: ${{ gitea.ref_name }} run: | RELEASE_JSON="$(curl --fail-with-body --silent --show-error \ --request POST \ --header "Authorization: token ${GITEA_TOKEN}" \ --header 'Content-Type: application/json' \ --data "{\"tag_name\":\"${RELEASE_TAG}\",\"name\":\"${RELEASE_TAG}\",\"draft\":false,\"prerelease\":false}" \ "${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases")" RELEASE_ID="$(printf '%s' "$RELEASE_JSON" | grep -o '"id":[0-9]*' | head -n 1 | cut -d: -f2)" test -n "$RELEASE_ID" curl --fail-with-body --silent --show-error \ --request POST \ --header "Authorization: token ${GITEA_TOKEN}" \ --form 'attachment=@dist/mahak-authenticate-bridge.zip' \ "${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=mahak-authenticate-bridge.zip"