ci: bump version from 0.1.4 to 0.1.5 #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: plugin-dist | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| jobs: | |
| detect: | |
| name: Detect changed plugins | |
| runs-on: ubuntu-latest | |
| outputs: | |
| packages: ${{ steps.packages.outputs.packages }} | |
| has-packages: ${{ steps.packages.outputs.has-packages }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine base revision | |
| id: base | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PUSH_BEFORE: ${{ github.event.before }} | |
| run: | | |
| set -euo pipefail | |
| NULL_SHA=0000000000000000000000000000000000000000 | |
| if [ "$EVENT_NAME" = "pull_request" ] && [ -n "$PR_BASE_SHA" ]; then | |
| BASE_SHA="$PR_BASE_SHA" | |
| elif [ -n "$PUSH_BEFORE" ] && [ "$PUSH_BEFORE" != "$NULL_SHA" ]; then | |
| BASE_SHA="$PUSH_BEFORE" | |
| elif git rev-parse HEAD^ >/dev/null 2>&1; then | |
| BASE_SHA="$(git rev-parse HEAD^)" | |
| else | |
| BASE_SHA="" | |
| fi | |
| echo "Base revision: ${BASE_SHA:-<none>}" | |
| echo "sha=$BASE_SHA" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Determine packages requiring build | |
| id: packages | |
| env: | |
| BASE_SHA: ${{ steps.base.outputs.sha }} | |
| run: python3 .github/scripts/detect_changed_plugins.py | |
| shell: bash | |
| dist: | |
| name: Build ${{ matrix.package }} @ ${{ matrix.target }} | |
| needs: detect | |
| if: needs.detect.outputs.has-packages == 'true' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ${{ fromJson(needs.detect.outputs.packages) }} | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - x86_64-apple-darwin | |
| - aarch64-apple-darwin | |
| - x86_64-pc-windows-msvc | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: aarch64-apple-darwin | |
| os: macos-14 | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| env: | |
| PACKAGE: ${{ matrix.package }} | |
| DIST_TARGET: ${{ matrix.target }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Cap'n Proto (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y capnproto | |
| - name: Install Rust targets (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| rustup target add x86_64-unknown-linux-gnu | |
| - name: Install Cap'n Proto (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install capnp | |
| - name: Install Rust targets (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| rustup target add x86_64-apple-darwin aarch64-apple-darwin | |
| - name: Install Cap'n Proto (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| Set-StrictMode -Version Latest | |
| $ErrorActionPreference = 'Stop' | |
| if (-not (Get-Command scoop -ErrorAction SilentlyContinue)) { | |
| Invoke-RestMethod get.scoop.sh | Invoke-Expression | |
| } | |
| if (-not (scoop bucket list | Select-String -Pattern 'main')) { | |
| scoop bucket add main | |
| } | |
| scoop install main/capnp | |
| - name: Install Rust targets (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| rustup target add x86_64-pc-windows-msvc | |
| - name: Cache cargo build artefacts | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Resolve package version | |
| id: package-version | |
| env: | |
| PACKAGE: ${{ matrix.package }} | |
| run: python3 .github/scripts/get_package_version.py --package "$PACKAGE" | |
| shell: bash | |
| - name: Build release binary | |
| run: | | |
| set -euo pipefail | |
| cargo build -p "$PACKAGE" --release --target "$DIST_TARGET" | |
| shell: bash | |
| - name: Package release archive | |
| id: package-archive | |
| env: | |
| VERSION: ${{ steps.package-version.outputs.version }} | |
| run: | | |
| set -euo pipefail | |
| ARCHIVE_PATH=$(python3 .github/scripts/package_archive.py \ | |
| --package "$PACKAGE" \ | |
| --version "$VERSION" \ | |
| --target "$DIST_TARGET" \ | |
| --release-dir "target/$DIST_TARGET/release" \ | |
| --output-dir "target/artifacts") | |
| ARCHIVE_NAME=$(basename "$ARCHIVE_PATH") | |
| UPLOAD_DIR="target/artifact_uploads/${PACKAGE}__${VERSION}__${DIST_TARGET}" | |
| UPLOAD_PATH="${UPLOAD_DIR}/${ARCHIVE_NAME}" | |
| mkdir -p "$UPLOAD_DIR" | |
| cp "$ARCHIVE_PATH" "$UPLOAD_PATH" | |
| echo "archive_name=$ARCHIVE_NAME" >> "$GITHUB_OUTPUT" | |
| echo "ARCHIVE_NAME=$ARCHIVE_NAME" >> "$GITHUB_ENV" | |
| echo "ARCHIVE_PATH=$ARCHIVE_PATH" >> "$GITHUB_ENV" | |
| echo "UPLOAD_PATH=$UPLOAD_PATH" >> "$GITHUB_ENV" | |
| shell: bash | |
| - name: Upload dist artefacts | |
| id: upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.package }}__${{ steps.package-version.outputs.version }}__${{ matrix.target }} | |
| path: ${{ env.UPLOAD_PATH }} | |
| if-no-files-found: error | |
| - name: Record artifact location | |
| if: success() | |
| env: | |
| VERSION: ${{ steps.package-version.outputs.version }} | |
| ARCHIVE_NAME: ${{ env.ARCHIVE_NAME }} | |
| ARTIFACT_ID: ${{ steps.upload.outputs.artifact-id }} | |
| ARTIFACT_API_URL: ${{ steps.upload.outputs.artifact-url }} | |
| REPOSITORY: ${{ github.repository }} | |
| RUN_ID: ${{ github.run_id }} | |
| REF_NAME: ${{ github.ref_name }} | |
| REF_TYPE: ${{ github.ref_type }} | |
| run: | | |
| set -euo pipefail | |
| MESSAGE="Artifact ${PACKAGE} (${DIST_TARGET}) uploaded: ${ARTIFACT_API_URL}" | |
| echo "::notice::${MESSAGE}" | |
| RELEASE_TAG="$REF_NAME" | |
| if [ "$REF_TYPE" != "tag" ] || [ -z "$RELEASE_TAG" ]; then | |
| RELEASE_TAG="${PACKAGE}-v${VERSION}" | |
| fi | |
| RELEASE_URL="https://github.com/${REPOSITORY}/releases/download/${RELEASE_TAG}/${ARCHIVE_NAME}" | |
| { | |
| echo "### ${PACKAGE} v${VERSION} (${DIST_TARGET})" | |
| echo "" | |
| echo "- Artifact URL: ${ARTIFACT_API_URL}" | |
| echo "- Release download (expected): ${RELEASE_URL}" | |
| echo "- Artifact ID: ${ARTIFACT_ID}" | |
| echo "- Workflow run: https://github.com/${REPOSITORY}/actions/runs/${RUN_ID}" | |
| echo "" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| shell: bash | |
| publish: | |
| name: Publish releases | |
| needs: | |
| - dist | |
| - detect | |
| if: needs.detect.outputs.has-packages == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| env: | |
| PACKAGES_JSON: ${{ needs.detect.outputs.packages }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download built artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: publish_artifacts | |
| - name: Publish GitHub releases | |
| run: python3 .github/scripts/publish_releases.py |