Skip to content

Commit

Permalink
Add release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckal777 committed Nov 14, 2022
1 parent 6245ca6 commit 1d734b1
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create release
on:
workflow_dispatch:
inputs:
version:
description: "The release name, something like vX.X.X"
required: true
env:
TARGET_VERSION: ${{ github.event.inputs.version }}
jobs:
release:
name: Create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
CRATE_VERSION=$(cat Cargo.toml | grep ^version | awk '{ print $3 }' | tr -d '"')
CRATE_VERSION=v${CRATE_VERSION}
echo version in Cargo.toml is $CRATE_VERSION
echo version in workflow is $TARGET_VERSION
if [ "$CRATE_VERSION" = "$TARGET_VERSION" ]; then
exit 0
else
exit 1
fi
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: cargo test --locked --all-features --release
- run: cargo install cargo-deb
- run: cargo deb
- run: cargo install cargo-generate-rpm
- run: cargo generate-rpm
- run: mv target/release/nuq target/release/nuq_${TARGET_VERSION}
- uses: ncipollo/release-action@v1
with:
artifacts: "target/release/nuq_${{ github.event.inputs.version }},target/debian/*.deb,target/generate-rpm/*.rpm"
artifactErrorsFailBuild: true
commit: ${{ github.sha }}
bodyFile: release-notes/${{ github.event.inputs.version }}.md
tag: ${{ github.event.inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ serde-transcode = "1.1"
serde_yaml = "0.9"
syntect = "5.0"
toml = "0.5"

[package.metadata.generate-rpm]
assets = [
{ source = "target/release/nuq", dest = "/usr/bin/nuq", mode = "0755" },
{ source = "LICENSE", dest = "/usr/share/doc/nuq/LICENSE", doc = true, mode = "0644" },
{ source = "README.md", dest = "/usr/share/doc/nuq/README.md", doc = true, mode = "0644" }
]

0 comments on commit 1d734b1

Please sign in to comment.