name: 'Publish ArchLinux package' author: 'Carlos Galindo' description: | Publishes an already-built package to Forgejo. inputs: repo_name: description: 'Name of the repository' default: 'pkgs' PKG_TOKEN: description: 'Token with package:write permissions' required: true runs: using: 'composite' steps: - uses: actions/download-artifact@v3 - id: publish_package name: Publish the package(s) run: | set -x echo "::add-mask::${{ inputs.PKG_TOKEN }}" ls packages | while read; do echo "##[group]Uploading package $REPLY" curl -X PUT $FORGEJO_SERVER_URL/api/packages/$FORGEJO_REPOSITORY_OWNER/arch/${{ inputs.repo_name }} \ -H "Authorization: token ${{ inputs.PKG_TOKEN }}" \ -H 'Content-Type: application/octet-stream' \ --data-binary "@packages/$REPLY" \ --fail-with-body --no-progress-meter echo "##[endgroup]" PKGNAME=$(echo $REPLY | rev | cut -d/ -f1 | cut -d- -f4- | rev) REPO_NAME=$(echo $FORGEJO_REPOSITORY | rev | cut -d/ -f1 | rev) echo "##[group]Linking $PKGNAME to $REPO_NAME" curl -X POST $FORGEJO_API_URL/packages/$FORGEJO_REPOSITORY_OWNER/arch/$PKGNAME/-/link/$REPO_NAME \ -H "Authorization: token ${{ inputs.PKG_TOKEN }}" \ --no-progress-meter echo "##[endgroup]" done