Skip to content

Commit 0955c0e

Browse files
authored
Prepare for crates.io and add release workflow (#46)
Fixes #29
1 parent f409ce4 commit 0955c0e

2 files changed

Lines changed: 32 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,18 @@ on:
66
- 'v*'
77

88
jobs:
9-
create-release:
10-
name: Create Release
9+
publish-crates-io:
10+
name: Publish to crates.io
1111
runs-on: ubuntu-latest
12-
outputs:
13-
upload_url: ${{ steps.create_release.outputs.upload_url }}
1412
steps:
15-
- name: Create Release
16-
id: create_release
17-
uses: softprops/action-gh-release@v1
18-
with:
19-
draft: false
20-
prerelease: false
21-
generate_release_notes: true
13+
- uses: actions/checkout@v4
14+
- name: Install Rust
15+
uses: dtolnay/rust-toolchain@stable
16+
- name: Publish to crates.io
17+
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
2218

2319
build-release:
2420
name: Build Release Binaries
25-
needs: create-release
2621
strategy:
2722
matrix:
2823
include:
@@ -41,18 +36,28 @@ jobs:
4136
uses: dtolnay/rust-toolchain@stable
4237
with:
4338
targets: ${{ matrix.target }}
44-
- name: Build
39+
- name: Build Binary
4540
run: cargo build --release --target ${{ matrix.target }}
46-
- name: Archive Binary
47-
shell: bash
48-
run: |
49-
BIN_NAME="envcheck"
50-
if [ "${{ matrix.os }}" = "windows-latest" ]; then
51-
BIN_NAME="envcheck.exe"
52-
fi
53-
cd target/${{ matrix.target }}/release
54-
tar czf ../../../envcheck-${{ github.ref_name }}-${{ matrix.target }}.tar.gz $BIN_NAME
55-
- name: Upload Release Asset
41+
- name: Upload Artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: envcheck-${{ matrix.target }}
45+
path: |
46+
target/${{ matrix.target }}/release/envcheck
47+
target/${{ matrix.target }}/release/envcheck.exe
48+
49+
create-github-release:
50+
name: Create GitHub Release
51+
needs: [build-release, publish-crates-io]
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: Download Artifacts
56+
uses: actions/download-artifact@v4
57+
with:
58+
path: artifacts
59+
- name: Create Release
5660
uses: softprops/action-gh-release@v1
5761
with:
58-
files: envcheck-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
62+
files: artifacts/**/*
63+
generate_release_notes: true

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ authors = ["envcheck contributors"]
66
description = "A lightweight CLI tool for validating developer environments"
77
license = "MIT"
88
repository = "https://github.com/dotandev/envcheck"
9+
readme = "README.md"
10+
homepage = "https://github.com/dotandev/envcheck"
11+
documentation = "https://docs.rs/envcheck"
912
keywords = ["cli", "environment", "validation", "developer-tools"]
1013
categories = ["command-line-utilities", "development-tools"]
1114

0 commit comments

Comments
 (0)