diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index afc556e9343..f18fd90d025 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,7 +10,7 @@ on: jobs: publish: runs-on: ubuntu-latest - if: github.repository == 'playcanvas/engine' + if: github.repository_owner == 'playcanvas' steps: - name: Check out code uses: actions/checkout@v5 @@ -50,10 +50,11 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Publish to code.playcanvas.com - run: | - if ! curl -fsS -X POST -H "Content-Type: application/json" \ - -d '{ "engineVersion": "${{ env.VERSION }}" }' ${{ secrets.PUBLISH_ENDPOINT }}; then - echo "Failed to publish to code.playcanvas.com" - exit 1 - fi \ No newline at end of file + - name: Write version + run: echo "${{ env.VERSION }}" > version.txt + + - name: Upload version + uses: actions/upload-artifact@v4 + with: + name: version + path: version.txt \ No newline at end of file diff --git a/.github/workflows/upload.yaml b/.github/workflows/upload.yaml new file mode 100644 index 00000000000..2ce282ee18c --- /dev/null +++ b/.github/workflows/upload.yaml @@ -0,0 +1,31 @@ +name: Upload + +on: + workflow_dispatch: + workflow_run: + workflows: ["Publish"] + types: + - completed + +jobs: + upload: + runs-on: ubuntu-latest + if: github.repository_owner == 'playcanvas' && github.event.workflow_run.conclusion == 'success' + steps: + - name: Download version + uses: actions/download-artifact@v4 + with: + name: version + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + + - name: Read version + run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV + + - name: Publish to code.playcanvas.com + run: | + if ! curl -fsS -X POST -H "Content-Type: application/json" \ + -d '{ "engineVersion": "${{ env.VERSION }}" }' ${{ secrets.PUBLISH_ENDPOINT }}; then + echo "Failed to publish to code.playcanvas.com" + exit 1 + fi \ No newline at end of file