Skip to content

ci: bump version from 0.1.3 to 0.1.4 #15

ci: bump version from 0.1.3 to 0.1.4

ci: bump version from 0.1.3 to 0.1.4 #15

Workflow file for this run

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: Cache cargo build artefacts
uses: Swatinem/rust-cache@v2
- name: Install cargo-dist
run: |
set -euo pipefail
INSTALL_ROOT="$RUNNER_TEMP/cargo-dist"
cargo install cargo-dist --locked --root "$INSTALL_ROOT"
echo "$INSTALL_ROOT/bin" >> "$GITHUB_PATH"
echo "CARGO_DIST_BIN=$INSTALL_ROOT/bin/cargo-dist" >> "$GITHUB_ENV"
shell: bash
- 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 artefacts
env:
VERSION: ${{ steps.package-version.outputs.version }}
CARGO_DIST_BIN: ${{ env.CARGO_DIST_BIN }}
run: |
set -euo pipefail
DIST_BIN="${CARGO_DIST_BIN:-$(command -v cargo-dist || true)}"
if [ ! -x "${DIST_BIN}" ]; then
echo "cargo-dist binary not found (expected at ${DIST_BIN:-<none>})" >&2
exit 1
fi
TAG="${PACKAGE}-${VERSION}"
mkdir -p target/dist
PLAN_FILE="target/dist/${PACKAGE}-${VERSION}-${DIST_TARGET}-plan.json"
"$DIST_BIN" plan --artifacts=all --ci github --target "$DIST_TARGET" --tag "$TAG" --allow-dirty --output-format=json --no-local-paths > "$PLAN_FILE"
"$DIST_BIN" build --artifacts=local --ci github --target "$DIST_TARGET" --tag "$TAG" --allow-dirty
shell: bash
- name: Build global artefacts (linux only)
if: matrix.target == 'x86_64-unknown-linux-gnu'
env:
VERSION: ${{ steps.package-version.outputs.version }}
CARGO_DIST_BIN: ${{ env.CARGO_DIST_BIN }}
run: |
set -euo pipefail
DIST_BIN="${CARGO_DIST_BIN:-$(command -v cargo-dist || true)}"
if [ ! -x "${DIST_BIN}" ]; then
echo "cargo-dist binary not found (expected at ${DIST_BIN:-<none>})" >&2
exit 1
fi
TAG="${PACKAGE}-${VERSION}"
"$DIST_BIN" build --artifacts=global --ci github --tag "$TAG" --allow-dirty
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: target/dist
if-no-files-found: error
- name: Record artifact location
if: success()
env:
VERSION: ${{ steps.package-version.outputs.version }}
ARTIFACT_ID: ${{ steps.upload.outputs.artifact-id }}
ARTIFACT_API_URL: ${{ steps.upload.outputs.artifact-url }}
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
run: |
set -euo pipefail
MESSAGE="Artifact ${PACKAGE} v${VERSION} (${DIST_TARGET}) uploaded: ${ARTIFACT_API_URL}"
echo "::notice::${MESSAGE}"
{
echo "### ${PACKAGE} v${VERSION} (${DIST_TARGET})"
echo ""
echo "- Artifact URL: ${ARTIFACT_API_URL}"
echo "- Artifact ID: ${ARTIFACT_ID}"
echo "- Workflow run: https://github.com/${REPOSITORY}/actions/runs/${RUN_ID}"
echo ""
} >> "$GITHUB_STEP_SUMMARY"
shell: bash