chore: update audited dependencies #50
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*.*.*" | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| id-token: write | |
| packages: write | |
| jobs: | |
| build-linux: | |
| name: Build Linux Executables | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.VERSION }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "linux-release" | |
| - name: Install cross-compilation tools | |
| uses: taiki-e/install-action@cross | |
| - name: Set version | |
| id: version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
| # For tagged releases, use the tag version | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| else | |
| # For main branch, generate prerelease version | |
| CURRENT_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') | |
| COMMIT_SHA=${GITHUB_SHA::7} | |
| VERSION="${CURRENT_VERSION}-preview.${COMMIT_SHA}" | |
| fi | |
| echo "Setting version to: ${VERSION}" | |
| echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
| # Update version in Cargo.toml | |
| sed -i "s/^version = .*/version = \"${VERSION}\"/" Cargo.toml | |
| - name: Build for Linux x64 | |
| run: cross build --release --target x86_64-unknown-linux-gnu | |
| - name: Build for Linux ARM64 | |
| run: cross build --release --target aarch64-unknown-linux-gnu | |
| - name: Rename binaries | |
| run: | | |
| cp target/x86_64-unknown-linux-gnu/release/hone hone-linux-x64 | |
| cp target/aarch64-unknown-linux-gnu/release/hone hone-linux-arm64 | |
| chmod +x hone-linux-x64 hone-linux-arm64 | |
| - name: Upload Linux executables | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hone-linux-executables | |
| path: | | |
| hone-linux-x64 | |
| hone-linux-arm64 | |
| build-vscode-extension: | |
| name: Build VSCode Extension | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.VERSION }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: editors/vscode/package-lock.json | |
| - name: Set version | |
| id: version | |
| working-directory: editors/vscode | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| else | |
| CURRENT_VERSION=$(grep '^version' ../../Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') | |
| COMMIT_SHA=${GITHUB_SHA::7} | |
| VERSION="${CURRENT_VERSION}-preview.${COMMIT_SHA}" | |
| fi | |
| echo "Setting version to: ${VERSION}" | |
| echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
| npm version "${VERSION}" --no-git-tag-version | |
| - name: Install dependencies | |
| working-directory: editors/vscode | |
| run: npm ci | |
| - name: Install vsce | |
| run: npm install -g @vscode/vsce | |
| - name: Build extension | |
| working-directory: editors/vscode | |
| run: npm run compile | |
| - name: Package VSIX | |
| working-directory: editors/vscode | |
| run: vsce package | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hone-vscode-extension | |
| path: editors/vscode/*.vsix | |
| build-macos: | |
| name: Build macOS Executables | |
| runs-on: macos-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.VERSION }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-apple-darwin,aarch64-apple-darwin | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "macos-release" | |
| - name: Set version in Cargo.toml | |
| id: version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| else | |
| CURRENT_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') | |
| COMMIT_SHA=${GITHUB_SHA::7} | |
| VERSION="${CURRENT_VERSION}-preview.${COMMIT_SHA}" | |
| fi | |
| echo "Setting version to: ${VERSION}" | |
| echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
| sed -i '' "s/^version = .*/version = \"${VERSION}\"/" Cargo.toml | |
| - name: Build for macOS x64 | |
| run: cargo build --release --target x86_64-apple-darwin | |
| - name: Build for macOS ARM64 | |
| run: cargo build --release --target aarch64-apple-darwin | |
| - name: Rename binaries | |
| run: | | |
| cp target/x86_64-apple-darwin/release/hone hone-darwin-x64 | |
| cp target/aarch64-apple-darwin/release/hone hone-darwin-arm64 | |
| chmod +x hone-darwin-x64 hone-darwin-arm64 | |
| - name: Upload macOS executables | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hone-macos-executables | |
| path: | | |
| hone-darwin-x64 | |
| hone-darwin-arm64 | |
| prerelease: | |
| name: Prerelease | |
| runs-on: ubuntu-latest | |
| needs: [build-linux, build-macos, build-vscode-extension] | |
| if: github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Linux executables | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hone-linux-executables | |
| path: ./executables | |
| - name: Download macOS executables | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hone-macos-executables | |
| path: ./executables | |
| - name: Download VSCode extension | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hone-vscode-extension | |
| path: ./executables | |
| - name: Create GitHub Preview Release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ needs.build-linux.outputs.version }} | |
| name: Preview v${{ needs.build-linux.outputs.version }} | |
| body: | | |
| ## Preview Release | |
| This is an automated preview release from the `main` branch. | |
| **Commit:** ${{ github.sha }} | |
| ## Installation | |
| ``` | |
| curl https://i.safia.sh/captainsafia/hone/v${{ needs.build-linux.outputs.version }} | sh | |
| ``` | |
| ## Manual Downloads | |
| | Platform | Architecture | Download | | |
| |----------|--------------|----------| | |
| | Linux | x64 | `hone-linux-x64` | | |
| | Linux | ARM64 | `hone-linux-arm64` | | |
| | macOS | x64 | `hone-darwin-x64` | | |
| | macOS | ARM64 | `hone-darwin-arm64` | | |
| ## VSCode Extension | |
| The VSCode extension VSIX file is also included in this release. | |
| draft: false | |
| prerelease: true | |
| files: | | |
| ./executables/hone-linux-x64 | |
| ./executables/hone-linux-arm64 | |
| ./executables/hone-darwin-x64 | |
| ./executables/hone-darwin-arm64 | |
| ./executables/*.vsix | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [build-linux, build-macos, build-vscode-extension] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Linux executables | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hone-linux-executables | |
| path: ./executables | |
| - name: Download macOS executables | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hone-macos-executables | |
| path: ./executables | |
| - name: Download VSCode extension | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: hone-vscode-extension | |
| path: ./executables | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| body: | | |
| ## Installation | |
| ``` | |
| curl https://i.safia.sh/captainsafia/hone/v${{ needs.build-linux.outputs.version }} | sh | |
| ``` | |
| ## Manual Downloads | |
| | Platform | Architecture | Download | | |
| |----------|--------------|----------| | |
| | Linux | x64 | `hone-linux-x64` | | |
| | Linux | ARM64 | `hone-linux-arm64` | | |
| | macOS | x64 | `hone-darwin-x64` | | |
| | macOS | ARM64 | `hone-darwin-arm64` | | |
| ## VSCode Extension | |
| The VSCode extension VSIX file is also included in this release. | |
| ## Changes | |
| See the [commits](https://github.com/captainsafia/hone/compare/v${{ steps.version.outputs.VERSION }}...HEAD) for details. | |
| draft: false | |
| prerelease: false | |
| files: | | |
| ./executables/hone-linux-x64 | |
| ./executables/hone-linux-arm64 | |
| ./executables/hone-darwin-x64 | |
| ./executables/hone-darwin-arm64 | |
| ./executables/*.vsix |