Readjusting Halstead Metrics (#98) #47
Workflow file for this run
This file contains 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: Build Binaries & Release | |
on: | |
push: | |
tags: | |
- "v*" | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
create_github_release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version | |
id: get_version | |
run: | | |
VERSION=$(grep '^version =' crates/fta/Cargo.toml | sed 's/^version = "\(.*\)"/\1/') | |
echo "Version: $VERSION" | |
echo "FTA_VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create GitHub release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: v${{ steps.get_version.outputs.FTA_VERSION }} | |
draft: true | |
prerelease: false | |
outputs: | |
version_name: ${{ steps.get_version.outputs.FTA_VERSION }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
build_binaries: | |
uses: ./.github/workflows/build.yml | |
upload_assets_macos: | |
needs: [create_github_release, build_binaries] | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download macOS artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: macos-binaries | |
- name: Upload macOS x86 tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_github_release.outputs.upload_url }} | |
asset_path: ./x86_64-apple-darwin.tar.gz | |
asset_name: fta-${{ needs.create_github_release.outputs.version_name }}-x86_64-apple-darwin.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload macOS silicon tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_github_release.outputs.upload_url }} | |
asset_path: ./aarch64-apple-darwin.tar.gz | |
asset_name: fta-${{ needs.create_github_release.outputs.version_name }}-aarch64-apple-darwin.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload binaries as artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: macos-binaries | |
path: | | |
*.tar.gz | |
upload_assets_windows: | |
needs: [create_github_release, build_binaries] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download windows artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: windows-binaries | |
- name: Upload Windows x86 zipfile | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_github_release.outputs.upload_url }} | |
asset_path: ./x86_64-pc-windows-msvc.zip | |
asset_name: fta-${{ needs.create_github_release.outputs.version_name }}-x86_64-pc-windows-msvc.zip | |
asset_content_type: application/zip | |
- name: Upload Windows ARM64 zipfile | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_github_release.outputs.upload_url }} | |
asset_path: ./aarch64-pc-windows-msvc.zip | |
asset_name: fta-${{ needs.create_github_release.outputs.version_name }}-aarch64-pc-windows-msvc.zip | |
asset_content_type: application/zip | |
- name: Upload binaries as artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: windows-binaries | |
path: | | |
*.zip | |
upload_assets_linux: | |
needs: [create_github_release, build_binaries] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download linux artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-binaries | |
- name: Upload aarch64-unknown-linux-musl tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_github_release.outputs.upload_url }} | |
asset_path: ./aarch64-unknown-linux-musl.tar.gz | |
asset_name: fta-${{ needs.create_github_release.outputs.version_name }}-aarch64-unknown-linux-musl.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload x86_64-unknown-linux-musl tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_github_release.outputs.upload_url }} | |
asset_path: ./x86_64-unknown-linux-musl.tar.gz | |
asset_name: fta-${{ needs.create_github_release.outputs.version_name }}-x86_64-unknown-linux-musl.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload arm-unknown-linux-musleabi tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_github_release.outputs.upload_url }} | |
asset_path: ./arm-unknown-linux-musleabi.tar.gz | |
asset_name: fta-${{ needs.create_github_release.outputs.version_name }}-arm-unknown-linux-musleabi.tar.gz | |
asset_content_type: application/gzip | |
publish_rust_crate: | |
runs-on: ubuntu-latest | |
needs: [upload_assets_macos, upload_assets_windows, upload_assets_linux] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update packages | |
run: sudo apt-get update | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
profile: minimal | |
target: x86_64-unknown-linux-musl | |
- name: Publish to crates.io | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: | | |
cargo publish --token $CARGO_REGISTRY_TOKEN | |
working-directory: crates/fta | |
publish_fta_cli: | |
needs: [upload_assets_macos, upload_assets_windows, upload_assets_linux] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Download macOS artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: macos-binaries | |
path: artifact/ | |
- name: Download linux artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-binaries | |
path: artifact/ | |
- name: Download windows artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: windows-binaries | |
path: artifact/ | |
- name: Extract nix artifacts | |
run: | | |
for file in artifact/*.tar.gz; do | |
base=$(basename -- "$file") | |
dirname="${base%%.*}" | |
mkdir -p packages/fta/binaries/"$dirname" | |
tar -xzf "$file" -C packages/fta/binaries/"$dirname" | |
done | |
- name: Extract artifacts | |
run: | | |
for file in artifact/*.zip; do | |
dir=$(basename "$file" .zip) | |
mkdir -p "packages/fta/binaries/$dir" | |
unzip -o "$file" -d "packages/fta/binaries/$dir" | |
done | |
# List out the binaries dir | |
ls -R packages/fta/binaries/ | |
- name: Publish to npm | |
run: npm publish | |
working-directory: packages/fta | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |