Compare commits

..

7 Commits

Author SHA1 Message Date
Paul van Tilburg a05106fecf
Bump the version to 0.5.0
Check and lint using Cargo / Check and lint (push) Successful in 4m23s Details
Release / Release (push) Successful in 8m38s Details
Release / Release crate (push) Failing after 4m36s Details
2023-06-08 10:36:38 +02:00
Paul van Tilburg c128bfea62
Update the changelog 2023-06-08 10:36:17 +02:00
Paul van Tilburg f7a5477804
Differentiate between publish and update time
Check and lint using Cargo / Check and lint (push) Successful in 6m42s Details
The `pubDate` field of an item in the feed is meant to be time the item
was published. It should not be bumped if the item is updated in the
backend.

* Introduce a new `published_at` field on `Item`
* Update the Mixcloud and YouTube backends to fill this field
* Use the `published_at` field on `Item` for the `<pubData>` item
  subelement
2023-06-08 10:10:34 +02:00
Paul van Tilburg 9fc9990c27
No longer configure using a sparse Cargo index for crates.io
Check and lint using Cargo / Check and lint (push) Successful in 3m50s Details
This is the default since Rust 1.70.
2023-06-06 07:46:24 +02:00
Paul van Tilburg 05f88dbb9e
Add a full release workflow
Check and lint using Cargo / Check and lint (push) Successful in 3m19s Details
2023-05-22 20:11:19 +02:00
Paul van Tilburg 409a69604e
Tweak step name 2023-05-22 20:10:45 +02:00
Paul van Tilburg b958734e92
Simplify Gitea Actions check and lint workflow
Check and lint using Cargo / Check and lint (push) Successful in 3m31s Details
2023-04-25 16:36:49 +02:00
10 changed files with 158 additions and 88 deletions

View File

@ -1,83 +0,0 @@
name: "Check, Test and Lint Using Cargo"
on:
- push
- pull_request
- workflow_dispatch
jobs:
check:
name: Check
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Use sparse Cargo index for crates.io
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
- name: Run cargo check
uses: https://github.com/actions-rs/cargo@v1
with:
command: check
# TODO: Add a test suite first!
# test:
# name: Test Suite
# runs-on: debian-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v3
#
# - name: Install stable toolchain
# uses: https://github.com/actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable
# override: true
#
# - name: Use sparse Cargo index for crates.io
# run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
#
# - name: Run cargo test
# uses: https://github.com/actions-rs/cargo@v1
# with:
# command: test
# args: --all-features
lints:
name: Lints
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Use sparse Cargo index for crates.io
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
- name: Run cargo fmt
uses: https://github.com/actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: https://github.com/actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

View File

@ -0,0 +1,46 @@
name: "Check and lint using Cargo"
on:
- pull_request
- push
- workflow_dispatch
jobs:
check_lint:
name: Check and lint
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install Rust stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Run cargo check
uses: https://github.com/actions-rs/cargo@v1
with:
command: check
- name: Run cargo clippy
uses: https://github.com/actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Run cargo fmt
uses: https://github.com/actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# TODO: Add a test suite first!
# - name: Run cargo test
# uses: https://github.com/actions-rs/cargo@v1
# with:
# command: test
# args: --all-features

View File

@ -0,0 +1,82 @@
name: "Release"
on:
push:
tags: "v*"
jobs:
release:
name: "Release"
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Determine the version of the release
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "Releasing version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install Rust stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-deb
uses: https://github.com/brndnmtthws/rust-action-cargo-binstall@v1
with:
packages: cargo-deb
- name: Run cargo-deb
uses: https://github.com/actions-rs/cargo@v1
with:
command: deb
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.1'
- name: Release to Gitea
uses: actions/release-action@main
with:
# This is available by default.
api_key: '${{ secrets.RELEASE_TOKEN }}'
files: target/debian/podbringer*.deb
title: 'Release ${{ env.VERSION }}'
release-crate:
name: "Release crate"
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Rust stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Use sparse Cargo index for crates.io
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
- name: Register the Gitea crate registry with Cargo
run: echo -e '[registries.luon]\nindex = "https://git.luon.net/paul/_cargo-index.git"' >> /root/.cargo/config.toml
- name: Run cargo publish
uses: https://github.com/actions-rs/cargo@v1
env:
# This needs to be provided for the repository; no login necessary as a result.
CARGO_REGISTRIES_LUON_TOKEN: '${{ secrets.CARGO_REGISTRIES_LUON_TOKEN }}'
with:
command: publish
args: --registry luon

View File

@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.5.0] - 2023-06-08
### Added
* Add full release Gitea Actions workflow
### Changed
* Simplify GItea Actions check and lint workflow
### Fixed
* Differentiate between publish and update time for items
## [0.4.1] - 2023-04-11
### Changed
@ -93,6 +107,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Initial release.
[Unreleased]: https://git.luon.net/paul/podbringer/compare/v0.4.1...HEAD
[0.5.0]: https://git.luon.net/paul/podbringer/compare/v0.4.1..v0.5.0
[0.4.1]: https://git.luon.net/paul/podbringer/compare/v0.4.0..v0.4.1
[0.4.0]: https://git.luon.net/paul/podbringer/compare/v0.3.0..v0.4.0
[0.3.0]: https://git.luon.net/paul/podbringer/compare/v0.2.0..v0.3.0

2
Cargo.lock generated
View File

@ -1495,7 +1495,7 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]]
name = "podbringer"
version = "0.4.1"
version = "0.5.0"
dependencies = [
"async-trait",
"cached",

View File

@ -1,6 +1,6 @@
[package]
name = "podbringer"
version = "0.4.1"
version = "0.5.0"
authors = ["Paul van Tilburg <paul@luon.net>"]
edition = "2021"
description = "Web service that provides podcasts for services that don't offer them (anymore)"

View File

@ -109,6 +109,9 @@ pub(crate) struct Item {
/// The URL of the image of the item.
pub(crate) image: Option<Url>,
/// The timestamp the item was published.
pub(crate) published_at: DateTime<Utc>,
/// The timestamp the item was last updated.
pub(crate) updated_at: DateTime<Utc>,
}

View File

@ -157,7 +157,10 @@ pub(crate) struct Cloudcast {
/// The tags of the cloudcast.
pub(crate) tags: Vec<Tag>,
/// The time the feed was created/started.
/// The time the feed was created.
pub(crate) created_time: DateTime<Utc>,
/// The time the feed was updated.
pub(crate) updated_time: DateTime<Utc>,
/// The original URL of the cloudcast.
@ -227,6 +230,7 @@ impl From<Cloudcast> for Item {
guid: cloudcast.slug,
keywords,
image: Some(cloudcast.pictures.large),
published_at: cloudcast.created_time,
updated_at: cloudcast.updated_time,
}
}

View File

@ -224,7 +224,9 @@ impl From<YouTubeVideoWithStream> for Item {
.date()
.and_hms_opt(12, 0, 0)
.expect("Invalid hour, minute and/or second");
let updated_at = DateTime::from_utc(timestamp, Utc);
let published_at = DateTime::from_utc(timestamp, Utc);
// There is no updated at timestamp available, really.
let updated_at = published_at;
Item {
title: video.title().to_string(),
@ -236,6 +238,7 @@ impl From<YouTubeVideoWithStream> for Item {
guid: id,
keywords,
image,
published_at,
updated_at,
}
}

View File

@ -125,7 +125,7 @@ fn construct_item(
.categories(categories)
.enclosure(Some(enclosure))
.guid(Some(guid))
.pub_date(Some(item.updated_at.to_rfc2822()))
.pub_date(Some(item.published_at.to_rfc2822()))
.itunes_ext(Some(itunes_ext))
.build()
}