Skip to content

Commit 8687cb9

Browse files
Remove stale issues workflow and add publish workflow for crates.io; update version to 0.1.10
2 parents 41f9d93 + 7544fc1 commit 8687cb9

File tree

5 files changed

+90
-49
lines changed

5 files changed

+90
-49
lines changed

.github/workflows/admin.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
publish:
13+
name: Publish to crates.io
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v2
19+
20+
- name: Set up Rust toolchain
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
profile: minimal
24+
toolchain: stable
25+
override: true
26+
27+
- name: Publish scanr to crates.io
28+
run: cargo publish --manifest-path Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/release.yml

Lines changed: 60 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,75 @@ on:
44
push:
55
tags:
66
- "v*"
7-
workflow_dispatch:
87

98
env:
109
CARGO_TERM_COLOR: always
1110

1211
jobs:
13-
build:
14-
runs-on: ubuntu-latest
15-
12+
release:
13+
name: "Release"
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
artifact_name: scanr
20+
asset_name: scanr-linux-gnu-amd64
21+
- os: windows-latest
22+
artifact_name: scanr.exe
23+
asset_name: scanr-windows-amd64.exe
24+
- os: macos-latest
25+
artifact_name: scanr
26+
asset_name: scanr-darwin-amd64
1627
steps:
17-
- name: Check out the repository
18-
uses: actions/checkout@v4
19-
20-
- name: Set up Rust
28+
- name: Checkout repository
29+
uses: actions/checkout@v2
30+
- name: Set up Rust toolchain
2131
uses: actions-rs/toolchain@v1
2232
with:
33+
profile: minimal
2334
toolchain: stable
35+
override: true
36+
- name: Build release
37+
run: cargo build --release --locked
38+
- name: Set prerelease flag (non-Windows)
39+
if: runner.os != 'Windows'
40+
run: |
41+
if [ $(echo ${{ github.ref }} | grep "rc") ]; then
42+
echo "PRERELEASE=true" >> $GITHUB_ENV
43+
echo "PRERELEASE=true"
44+
else
45+
echo "PRERELEASE=false" >> $GITHUB_ENV
46+
echo "PRERELEASE=false"
47+
fi
48+
echo $PRERELEASE
49+
VERSION=$(echo ${{ github.ref }} | sed 's/refs\/tags\///g')
50+
echo "VERSION=$VERSION" >> $GITHUB_ENV
51+
echo "VERSION=$VERSION"
52+
- name: Set prerelease flag (Windows)
53+
if: runner.os == 'Windows'
54+
shell: powershell
55+
run: |
56+
$full = "${{ github.ref }}"
2457
25-
- name: Build the project
26-
run: cargo build --release
27-
28-
publish:
29-
needs: build
30-
runs-on: ubuntu-latest
31-
32-
steps:
33-
- name: Check out the repository
34-
uses: actions/checkout@v4
58+
if ( $full -like '*rc*' ) {
59+
echo "PRERELEASE=true" >> $env:GITHUB_ENV
60+
echo "PRERELEASE=true"
61+
} else {
62+
echo "PRERELEASE=false" >> $env:GITHUB_ENV
63+
echo "PRERELEASE=false"
64+
}
3565
36-
- name: Set up Rust
37-
uses: actions-rs/toolchain@v1
66+
$trimmed = $full -replace 'refs/tags/',''
67+
echo "VERSION=$trimmed" >> $env:GITHUB_ENV
68+
echo "VERSION=$trimmed"
69+
- name: Upload release assets
70+
uses: svenstaro/upload-release-action@v2
3871
with:
39-
toolchain: stable
40-
41-
- name: Publish to crates.io
42-
env:
43-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
44-
run: cargo publish
72+
repo_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
73+
file: target/release/${{ matrix.artifact_name }}
74+
asset_name: ${{ matrix.asset_name }}
75+
tag: ${{ github.ref }}
76+
prerelease: ${{ env.PRERELEASE }}
77+
release_name: "scanr ${{ env.VERSION }}"
78+
body: "Please refer to **[CHANGELOG.md](https://github.com/trinhminhtriet/scanr/blob/master/CHANGELOG.md)** for information on this release."

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "scanr"
3-
version = "0.1.9"
3+
version = "0.1.10"
44
edition = "2021"
55
authors = ["Triet Trinh <[email protected]>"]
66
description = "ScanR: A lightweight, fast, and configurable port scanner built in Rust for reliable multi-platform network scanning."

0 commit comments

Comments
 (0)