fix: remove hm-plugin-sdk from release workflow #7
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| crates-io: | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install esbuild (for harmont-ts bundle) | |
| working-directory: dsls/harmont-ts | |
| run: npm ci | |
| - name: Set version from tag | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-plugin-protocol/Cargo.toml | |
| sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm/Cargo.toml | |
| # Rewrite workspace.dependencies pins so dependents resolve to the | |
| # tagged version (cargo publish strips path deps; the version field | |
| # is what consumers will receive). | |
| sed -i "s|hm-plugin-protocol = { path = \"crates/hm-plugin-protocol\", version = \"0.0.0-dev\" }|hm-plugin-protocol = { path = \"crates/hm-plugin-protocol\", version = \"$VERSION\" }|" Cargo.toml | |
| cargo check --workspace --exclude hm-fixtures | |
| - name: Publish hm-plugin-protocol | |
| run: | | |
| if curl -sf -A "harmont-release-ci (github-actions)" "https://crates.io/api/v1/crates/hm-plugin-protocol/$VERSION" > /dev/null 2>&1; then | |
| echo "hm-plugin-protocol@$VERSION already published, skipping" | |
| else | |
| cargo publish -p hm-plugin-protocol --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty | |
| fi | |
| - name: Wait for crates.io index | |
| run: sleep 30 | |
| - name: Publish harmont-cli | |
| run: | | |
| if curl -sf -A "harmont-release-ci (github-actions)" "https://crates.io/api/v1/crates/harmont-cli/$VERSION" > /dev/null 2>&1; then | |
| echo "harmont-cli@$VERSION already published, skipping" | |
| else | |
| cargo publish -p harmont-cli --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty | |
| fi | |
| pypi-publish: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| environment: | |
| name: release | |
| url: https://pypi.org/project/harmont/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Set version from tag | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| sed -i '0,/version = "0.0.0-dev"/s//version = "'"$VERSION"'"/' dsls/harmont-py/pyproject.toml | |
| grep -n "^version" dsls/harmont-py/pyproject.toml | |
| - name: Install build | |
| run: python -m pip install --upgrade build | |
| - name: Build sdist and wheel | |
| working-directory: dsls/harmont-py | |
| run: python -m build | |
| - name: Inspect dist | |
| working-directory: dsls/harmont-py | |
| run: | | |
| ls -la dist/ | |
| test -f dist/harmont-${VERSION}.tar.gz | |
| test -f dist/harmont-${VERSION}-py3-none-any.whl | |
| - name: Publish to PyPI via Trusted Publishing | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dsls/harmont-py/dist/ | |
| build-binary: | |
| name: Build ${{ matrix.target }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| - target: aarch64-unknown-linux-gnu | |
| runner: ubuntu-24.04-arm | |
| - target: aarch64-apple-darwin | |
| runner: macos-latest | |
| - target: x86_64-apple-darwin | |
| runner: macos-latest | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: dsls/harmont-ts/package-lock.json | |
| - name: Install esbuild | |
| working-directory: dsls/harmont-ts | |
| run: npm ci | |
| - name: Set version from tag | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| sed -i'' -e 's/version = "0.0.0-dev"/version = "'"$VERSION"'"/' crates/hm/Cargo.toml | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} -p harmont-cli | |
| - name: Package | |
| run: | | |
| ARCHIVE="hm-${VERSION}-${{ matrix.target }}.tar.gz" | |
| tar czf "$ARCHIVE" -C "target/${{ matrix.target }}/release" hm | |
| echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: hm-${{ matrix.target }} | |
| path: ${{ env.ARCHIVE }} | |
| retention-days: 1 | |
| github-release: | |
| name: Create GitHub Release | |
| timeout-minutes: 10 | |
| needs: build-binary | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "$GITHUB_REF_NAME" \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --title "$GITHUB_REF_NAME" \ | |
| --generate-notes \ | |
| artifacts/* |