Skip to content

Commit

Permalink
Revamp.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngirard committed Mar 10, 2024
1 parent a13d57e commit 92584da
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 45 deletions.
87 changes: 51 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,61 @@
name: Release
name: Build and Release Packages

on:
push:
tags:
- 'v*'
- '*' # Trigger the workflow on push of any tag

jobs:
release:
build-and-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build deb package
run: |
mkdir -p bash-sqlite-toolkit_${{ github.ref_name }}_all/usr/local/lib
cp sqlite_toolkit.sh bash-sqlite-toolkit_${{ github.ref_name }}_all/usr/local/lib/
mkdir -p bash-sqlite-toolkit_${{ github.ref_name }}_all/DEBIAN
echo "Package: bash-sqlite-toolkit" > bash-sqlite-toolkit_${{ github.ref_name }}_all/DEBIAN/control
echo "Version: ${{ github.ref_name }}" >> bash-sqlite-toolkit_${{ github.ref_name }}_all/DEBIAN/control
echo "Architecture: all" >> bash-sqlite-toolkit_${{ github.ref_name }}_all/DEBIAN/control
echo "Maintainer: Your Name <[email protected]>" >> bash-sqlite-toolkit_${{ github.ref_name }}_all/DEBIAN/control
echo "Description: Bash SQLite Toolkit" >> bash-sqlite-toolkit_${{ github.ref_name }}_all/DEBIAN/control
dpkg-deb --build bash-sqlite-toolkit_${{ github.ref_name }}_all
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload deb package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bash-sqlite-toolkit_${{ github.ref_name }}_all.deb
asset_name: bash-sqlite-toolkit_${{ github.ref_name }}_all.deb
asset_content_type: application/vnd.debian.binary-package
- name: Checkout Repository
uses: actions/checkout@main

- name: Create DEB Package
uses: burningalchemist/nfpm-action@v1
id: deb-package
with:
nfpm_version: "2.35.1"
config: "nfpm.yaml" # Replace with your nfpm configuration file
packager: "deb"

- name: Create RPM Package
uses: burningalchemist/nfpm-action@v1
id: rpm-package
with:
nfpm_version: "2.35.1"
config: "nfpm.yaml" # Replace with your nfpm configuration file
packager: "rpm"

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ github.ref }}
tag_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Upload DEB Package to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.deb-package.outputs.package }}
asset_name: obsidian-shell-lib_${{ github.run_number }}_amd64.deb
asset_content_type: application/vnd.debian.binary-package

- name: Upload RPM Package to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.rpm-package.outputs.package }}
asset_name: obsidian-shell-lib_${{ github.run_number }}_amd64.rpm
asset_content_type: application/x-rpm
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bash SQLite Toolkit
# Bash SQLite library

This project provides an ergonomic Bash library for Linux that leverages `coproc` to connect to an SQLite database using `sqlite3` and allows performing queries against it while retrieving results efficiently and ergonomically.

Expand All @@ -14,10 +14,10 @@ This project provides an ergonomic Bash library for Linux that leverages `coproc

### Using `deb` Package

1. Download the latest `deb` package from the [Releases](https://github.com/ngirard/bash-sqlite-toolkit/releases) page.
1. Download the latest `deb` package from the [Releases](https://github.com/ngirard/sqlite-shell-lib/releases) page.
2. Install the package using the following command:
```sh
sudo dpkg -i bash-sqlite-toolkit_<version>_all.deb
sudo dpkg -i sqlite-shell-lib_<version>_all.deb
```

The library will be installed in `/usr/local`.
Expand All @@ -26,17 +26,17 @@ This project provides an ergonomic Bash library for Linux that leverages `coproc

1. Include the library in your Bash script:
```bash
source /usr/local/lib/sqlite_toolkit.sh
source /usr/local/lib/sqlite-shell-lib.sh
```

2. Use the provided functions to interact with SQLite databases:

connect_to_db <db_name> <db_file>: Establishes a connection to an SQLite database.
execute_query <db_name> <query> [<column_separator>] [<row_separator>]: Executes an SQL query and retrieves the results.
execute_non_tuple_query <db_name> <query>: Executes a query that doesn't produce tuples.
close_db_connection <db_name>: Closes a database connection.
`connect_to_db <db_name> <db_file>`: Establishes a connection to an SQLite database.
`execute_query <db_name> <query> [<column_separator>] [<row_separator>]`: Executes an SQL query and retrieves the results.
`execute_non_tuple_query <db_name> <query>`: Executes a query that doesn't produce tuples.
`close_db_connection <db_name>`: Closes a database connection.

Refer to the comments in the sqlite_toolkit.sh file for more details on each function.
Refer to the comments in the sqlite-shell-lib.sh file for more details on each function.
Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
Expand Down
31 changes: 31 additions & 0 deletions nfpm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: sqlite-shell-lib
arch: amd64
platform: linux
section: default
priority: extra
maintainer: Nicolas Girard <[email protected]>
description: Utility shell library for SQLite
vendor: "Nicolas Girard"
homepage: "https://github.com/ngirard/sqlite-shell-lib"
license: MIT
disable_globbing: false

# Version
version: ${VERSION}
version_schema: semver

# Dependencies.
depends:
- sqlite3

# Contents to add to the package
contents:
- src: lib/sqlite-shell-lib.sh
dst: /usr/local/lib/sqlite-shell-lib.sh

# Umask to be used on files without explicit mode set.
umask: 0o002

# Custom configuration applied only to the Deb packager.
deb:
compression: gzip
File renamed without changes.

0 comments on commit 92584da

Please sign in to comment.