Create release #7
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: 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 }} | |
JQ_LIB_DIR: /usr/lib/x86_64-linux-gnu | |
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 | |
- name: Install libjq-dev and libonig-dev | |
run: | | |
sudo apt-get update | |
sudo apt-get install libjq-dev libonig-dev | |
- 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 }} |