Skip to content

Commit 2551185

Browse files
authored
Merge pull request #3 from passageidentity/PSG-4550-add-ci-release-workflow
ci: PSG-4550 adds workflows for pull requests, publishing package, and deprecating or re-indexing a published version
2 parents 8a61a60 + b365b3c commit 2551185

File tree

5 files changed

+151
-0
lines changed

5 files changed

+151
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish to crate.io
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
9+
jobs:
10+
run-test-workflow:
11+
uses: ./.github/workflows/on-pull-request.yml
12+
13+
publish:
14+
name: Publish to crate.io
15+
needs: run-test-workflow
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-toolchain@stable
20+
21+
- uses: katyo/publish-crates@v2
22+
with:
23+
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
24+
25+
tag-and-release:
26+
name: Tag and Release
27+
needs: publish
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Get version
35+
id: get_version
36+
run: echo "version=$(cat Cargo.toml | grep version | head -n1 | cut -d '"' -f2)" >> "$GITHUB_OUTPUT"
37+
38+
- uses: rickstaa/action-create-tag@v1
39+
id: tag_create
40+
with:
41+
tag: v${{ steps.get_version.outputs.version }}
42+
43+
- name: Create Release
44+
if: !steps.tag_create.outputs.tag_exists
45+
uses: actions/create-release@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: v${{ steps.get_version.outputs.version }}
50+
release_name: v${{ steps.get_version.outputs.version }}

.github/workflows/on-pull-request.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Run build and tests
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
lint-format:
12+
name: Lint and Format
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: dtolnay/rust-toolchain@stable
17+
18+
- name: Install clippy
19+
run: rustup component add clippy
20+
- name: Check linting
21+
cargo clippy --all-targets --all-features -- -D warnings
22+
23+
- name: Install rustfmt
24+
run: rustup component add rustfmt
25+
- name: Check formatting
26+
run: cargo fmt --all -- --check
27+
28+
build-and-test:
29+
name: Build and Test
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: dtolnay/rust-toolchain@stable
34+
35+
- name: Build
36+
run: cargo build --release --verbose
37+
- name: Test
38+
run: cargo test --release --no-fail-fast --verbose
39+
40+
publish-check:
41+
name: Publish Check
42+
needs:
43+
- lint-format
44+
- build-and-test
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: dtolnay/rust-toolchain@stable
49+
- uses: katyo/publish-crates@v2
50+
with:
51+
dry-run: true

.github/workflows/un-yank.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Undo a Yank of a published version from crate.io
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: The version number you wish to un-yank from crate.io
8+
required: true
9+
type: string
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
yank:
16+
name: Undo a Yank of a published version from crate.io
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: dtolnay/rust-toolchain@stable
20+
- name: Yank
21+
if: github.event.inputs.version != ''
22+
run: cargo yank --version ${{ github.event.inputs.version }} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/yank.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Yank a published version from crate.io
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: The version number you wish to yank from crate.io
8+
required: true
9+
type: string
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
yank:
16+
name: Yank a published version from crate.io
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: dtolnay/rust-toolchain@stable
20+
- name: Yank
21+
if: github.event.inputs.version != ''
22+
run: cargo yank ${{ github.event.inputs.version }} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
name = "passage_flex"
33
version = "0.1.0"
44
edition = "2021"
5+
authors = ["support@passage.id"]
6+
description = "Provides verification of server-side authentication for applications using Passage Passkey Flex"
7+
homepage = "https://github.com/passageidentity/passage-flex-rust"
8+
repository = "https://github.com/passageidentity/passage-flex-rust"
9+
readme = "README.md"
10+
license = "MIT"
511

612
[dependencies]
713
http = "^1.1.0"

0 commit comments

Comments
 (0)