From eb38eb219e8e4ce8d4370422ece72c2f664d66b9 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Thu, 24 Oct 2024 13:23:04 -0400 Subject: [PATCH] feat: PR builds --- .github/workflows/main.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46f982fda..fa6769a88 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -171,6 +171,45 @@ jobs: retention-days: 5 if-no-files-found: error + release-pull-request: + if: | + github.event_name == 'pull_request' && + github.event.action == 'opened' && + github.event.pull_request.base.ref == 'main' + runs-on: ubuntu-latest + needs: [build-plugin] + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Make PR Release Folder + run: mkdir pr-release/ + + - name: Download unraid-api binary tgz + uses: actions/download-artifact@v4 + with: + name: unraid-api + path: pr-release + + - name: Download plugin binary tgz + uses: actions/download-artifact@v4 + with: + name: connect-files + - name: Upload to Cloudflare + uses: jakejarvis/s3-sync-action@v0.5.1 + env: + AWS_S3_ENDPOINT: ${{ secrets.CF_ENDPOINT }} + AWS_S3_BUCKET: ${{ secrets.CF_BUCKET_PREVIEW }} + AWS_ACCESS_KEY_ID: ${{ secrets.CF_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }} + AWS_REGION: "auto" + SOURCE_DIR: pr-release + DEST_DIR: unraid-api/${{ github.event.pull_request.number }} + - name: Print Path to Plugin Install + run: | + echo "Use the following URL to install the plugin on your Unraid server" + echo "https://${{ secrets.CF_BUCKET_PREVIEW }}.${{ secrets.CF_ENDPOINT }}/unraid-api/${{ github.event.pull_request.number }}/dynamix.unraid.net.staging.txz" + release-staging: environment: name: staging