Skip to content

Commit 518c32b

Browse files
committed
Set up as a gem
1 parent 6f4cabc commit 518c32b

File tree

4 files changed

+105
-4
lines changed

4 files changed

+105
-4
lines changed

Diff for: .github/workflows/build_gem.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build gem
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
release_tag:
10+
description: "Release tag"
11+
required: true
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
build-gem:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
bundler-cache: true
26+
ruby-version: ruby
27+
28+
- name: Get tag
29+
id: get-tag
30+
run: echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
31+
32+
- name: Install dependencies
33+
run: bundle install
34+
35+
- name: Build gem
36+
run: gem build good_audible_story_sync.gemspec -o good-audible-story-sync-${SOURCE_TAG}.gem
37+
env:
38+
SOURCE_TAG: ${{ env.SOURCE_TAG }}
39+
40+
- name: Create release
41+
uses: softprops/action-gh-release@v2
42+
with:
43+
files: good-audible-story-sync-${SOURCE_TAG}.gem
44+
tag_name: ${{ github.event.inputs.release_tag }}
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
env:
47+
SOURCE_TAG: ${{ env.SOURCE_TAG }}

Diff for: README.md

+36-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ Script to sync your read books from Audible to Goodreads and StoryGraph.
44

55
## How to use
66

7-
This is intended to be run from macOS.
7+
> [!NOTE]
8+
> This is intended to be run from macOS.
9+
10+
Download the [latest release](https://github.com/cheshire137/good-audible-story-sync/releases/latest) of the gem. Install it via:
811

912
```sh
10-
bin/good-audible-story-sync
13+
gem install good-audible-story-sync.gem
14+
```
15+
16+
There should now be a `good-audible-story-sync` executable in your path. Run it via:
17+
18+
```sh
19+
good-audible-story-sync
1120
```
1221

1322
You will be prompted to log in to Audible and Storygraph. The tool saves your encrypted login
@@ -22,7 +31,7 @@ you finished reading and when.
2231
### Options
2332

2433
```sh
25-
Usage: bin/good-audible-story-sync [options]
34+
Usage: good-audible-story-sync [options]
2635
-d DATABASE_FILE, Path to Sqlite database file. Defaults to good_audible_story_sync.db.
2736
--database-file
2837
-e EXPIRATION_DAYS, Max number of days to use cached data, such as Audible library, before refreshing. Defaults to 1.
@@ -32,7 +41,7 @@ Usage: bin/good-audible-story-sync [options]
3241
### Sample output
3342

3443
```sh
35-
% bin/good-audible-story-sync
44+
% good-audible-story-sync
3645
🔐 Looking for 'good_audible_story_sync_encryption_key' in cheshire137's keychain...
3746
ℹ️ Using GoodAudibleStorySync encryption key from keychain
3847
⚙️ Parsing options...
@@ -59,6 +68,29 @@ bin/good-audible-story-sync
5968
6069
Run `srb tc` to run the [Sorbet type checker](https://sorbet.org/).
6170
71+
### Creating a tag
72+
73+
Update `VERSION` in [version.rb](./lib/good_audible_story_sync/version.rb).
74+
75+
```sh
76+
git tag v0.0.x main # use the same version string as in `VERSION`
77+
git push origin tag v0.0.x
78+
```
79+
80+
This will trigger a workflow that builds the gem and creates a new release.
81+
82+
### Building the gem
83+
84+
```sh
85+
gem build good_audible_story_sync.gemspec
86+
```
87+
88+
This will create a file like project_pull_mover-0.0.1.gem which you can then install:
89+
90+
```sh
91+
gem install good_audible_story_sync-0.0.1.gem
92+
```
93+
6294
## Thanks
6395
6496
- [mkb79's Python Audible library](https://github.com/mkb79/Audible) for providing an example of how to authenticate with Audible and use its API, including the [unofficial API docs](https://audible.readthedocs.io/en/master/misc/external_api.html).

Diff for: good_audible_story_sync.gemspec

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require_relative "lib/good_audible_story_sync/version"
2+
3+
Gem::Specification.new do |s|
4+
s.name = "good_audible_story_sync"
5+
s.version = GoodAudibleStorySync::VERSION
6+
s.summary = "Command-line tool to sync your read books from Audible to Storygraph and, eventually, Goodreads."
7+
s.description = "Interactive script to mark books as finished as well as set the finish date on Storygraph, based on your Audible activity."
8+
s.authors = ["Sarah Vessels"]
9+
s.email = "cheshire137@gmail.com"
10+
s.files = Dir['lib/**/*'] + %w[LICENSE README.md]
11+
s.bindir = "bin"
12+
s.require_paths = ["lib"]
13+
s.executables = ["good-audible-story-sync"]
14+
s.homepage = "https://github.com/cheshire137/good-audible-story-sync"
15+
s.license = "MIT"
16+
end

Diff for: lib/good_audible_story_sync/version.rb

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# typed: strict
2+
# frozen_string_literal: true
3+
4+
module GoodAudibleStorySync
5+
VERSION = "0.0.1"
6+
end

0 commit comments

Comments
 (0)