diff --git a/.github/workflows/public-release-with-apk.yml b/.github/workflows/public-release-with-apk.yml new file mode 100644 index 0000000..71ee388 --- /dev/null +++ b/.github/workflows/public-release-with-apk.yml @@ -0,0 +1,49 @@ +name: Create or Update Release + +on: + workflow_dispatch: + repository_dispatch: + types: [publish-apk] + +jobs: + create-or-update-release: + runs-on: ubuntu-latest + steps: + - name: Set up variables + id: setup + run: | + VERSION=${{ github.event.client_payload.version }} + SHORT_COMMIT_HASH=${{ github.event.client_payload.short_commit_hash }} + ORIGINAL_APK_FILE=${{ github.event.client_payload.original_apk_file }} + RELEASE_ID=${{ github.event.client_payload.release_id }} + + TAG_NAME="v$VERSION" + RELEASE_TITLE="Fedi Alpha v${VERSION%.*} - APK Download" + NEW_APK_FILE="app-production-release-${VERSION}-${SHORT_COMMIT_HASH}.apk" + echo "VERSION $VERSION" + echo "SHORT_COMMIT_HASH $SHORT_COMMIT_HASH" + echo "ORIGINAL_APK_FILE $ORIGINAL_APK_FILE" + echo "TAG_NAME $TAG_NAME" + echo "RELEASE_TITLE $RELEASE_TITLE" + echo "NEW_APK_FILE $NEW_APK_FILE" + echo "RELEASE_ID $RELEASE_ID" + + echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_OUTPUT + + - name: Run GH script + uses: actions/github-script@v7 + id: gh-script + env: + RELEASE_ID: ${{ steps.setup.RELEASE_ID }} + with: + github-token: ${{ secrets.SOURCE_GH_TOKEN }} + result-encoding: string + script: | + const { RELEASE_ID } = process.env + const result = github.rest.repos.listReleaseAssets({ + owner: setlife-network, + repo: fedi, + release_id: RELEASE_ID + }) + + console.log(`result: ${result}`)