name: Build and Deploy Extensions on: workflow_dispatch: inputs: isNightly: description: 'Is this a nightly build?' type: boolean required: true default: false workflow_call: inputs: isNightly: type: boolean description: 'Is this a nightly build?' required: true default: false # Every run pulls the published image, replaces one releases/ directory and pushes # the image back, so runs that overlap would drop each other's changes. A run called # from Build and Deploy waits here too, while that workflow's other jobs go on. concurrency: group: extension-image queue: max jobs: release-target: runs-on: ubuntu-latest permissions: contents: read outputs: version: ${{ steps.target.outputs.version }} steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: persist-credentials: false sparse-checkout: | /CMakeLists.txt /scripts/extension/ sparse-checkout-cone-mode: false - name: Check which releases/ directory this run may write id: target env: IS_NIGHTLY: ${{ inputs.isNightly == true || github.event.inputs.isNightly == 'true' }} REF_TYPE: ${{ github.ref_type }} REF_NAME: ${{ github.ref_name }} REPO_URL: ${{ github.server_url }}/${{ github.repository }} run: | version=$(python3 scripts/extension/release_target.py --nightly "$IS_NIGHTLY" \ --ref-type "$REF_TYPE" --ref-name "$REF_NAME" --repo-url "$REPO_URL") echo "Deploying to releases/$version" echo "version=$version" >> "$GITHUB_OUTPUT" build-extensions: needs: release-target uses: ./.github/workflows/build-extensions.yml get-ghcr-extensions: needs: release-target uses: ./.github/workflows/get-extensions-from-ghcr.yml package-built-extensions: runs-on: ubuntu-22.04 needs: - release-target - build-extensions - get-ghcr-extensions env: RELEASE_VERSION: ${{ needs.release-target.outputs.version }} steps: - name: Free disk space on Ubuntu runner uses: kfir4444/free-disk-space@main with: tool-cache: true android: true dotnet: true haskell: true large-packages: true swap-storage: true - uses: actions/download-artifact@v4 with: name: ghcr-extensions - name: Clear old artifacts run: rm -rf releases/$RELEASE_VERSION/ - name: Create temporary directory for artifacts run: | mkdir -p extension-artifacts mkdir -p extension-artifacts/linux_amd64 mkdir -p extension-artifacts/linux_arm64 mkdir -p extension-artifacts/linux_x86 mkdir -p extension-artifacts/osx_amd64 mkdir -p extension-artifacts/osx_arm64 mkdir -p extension-artifacts/win_amd64 - name: Download built artifacts for linux-x86_64 uses: actions/download-artifact@v4 with: name: lbug-extensions-linux-x86_64 path: extension-artifacts/linux_amd64 - name: Download built artifacts for linux-aarch64 uses: actions/download-artifact@v4 with: name: lbug-extensions-linux-aarch64 path: extension-artifacts/linux_arm64 - name: Download built artifacts for osx-aarch64 uses: actions/download-artifact@v4 with: name: lbug-extensions-osx-arm64 path: extension-artifacts/osx_arm64 - name: Download built artifacts for osx-x86_64 uses: actions/download-artifact@v4 with: name: lbug-extensions-osx-x86_64 path: extension-artifacts/osx_amd64 - name: Download built artifacts for windows-x86_64 uses: actions/download-artifact@v4 with: name: lbug-extensions-win-x86_64 path: extension-artifacts/win_amd64 - name: Copy built artifacts run: | rsync -av extension-artifacts/ releases/$RELEASE_VERSION/ - name: Remove temporary directory run: rm -rf extension-artifacts - name: Set artifact permissions run: | chmod -R 755 releases/$RELEASE_VERSION - name: List downloaded artifacts run: ls -R releases/$RELEASE_VERSION - name: Upload new artifacts uses: actions/upload-artifact@v4 with: name: lbug-extensions path: releases smoke-test-extensions: needs: - release-target - build-extensions # No released engine reads vdev, so a nightly has nothing to check. if: ${{ needs.release-target.outputs.version != 'vdev' }} uses: ./.github/workflows/smoke-test-extensions.yml permissions: contents: read with: line: ${{ needs.release-target.outputs.version }} deploy-extensions: needs: - package-built-extensions - smoke-test-extensions if: >- ${{ !cancelled() && needs.package-built-extensions.result == 'success' && contains(fromJSON('["success", "skipped"]'), needs.smoke-test-extensions.result) }} uses: ./.github/workflows/deploy-extension.yml secrets: inherit