-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up repository for BlueskyAPI releases.
- Loading branch information
0 parents
commit e7052c7
Showing
6 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- gradle/libs.versions.toml | ||
|
||
jobs: | ||
update-version: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: "Checkout repo" | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: "Set version as envionment variable" | ||
run: echo "LATEST_VERSION=$(awk -F\" '/sh.christian.ozone:bluesky/ { print $4 }' < gradle/libs.versions.toml)" >> $GITHUB_ENV | ||
|
||
- name: "Update Package.swift" | ||
run: ./update_version.sh ${{ env.LATEST_VERSION }} | ||
|
||
- name: "Commit changes back to repo" | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "Releasing v${{ env.LATEST_VERSION }}." | ||
tagging_message: "${{ env.LATEST_VERSION }}" | ||
file_pattern: "Package.swift" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
![Maven Central](https://img.shields.io/maven-central/v/sh.christian.ozone/bluesky?versionPrefix=0.0.9) ![CI](https://github.com/christiandeange/ozone/actions/workflows/ci.yml/badge.svg) | ||
|
||
BlueskyAPI | ||
========== | ||
|
||
### Overview | ||
|
||
Swift bindings for Bluesky Social, powered by [Ozone](https://github.com/christiandeange/ozone). No relation to the moderation tools also named [Ozone](https://github.com/bluesky-social/ozone). | ||
|
||
> **Warning** | ||
> | ||
> 🚧 🚧 🚧 Everything in here is very much a work-in-progress! | ||
> The [upstream schemas](https://github.com/christiandeange/ozone/commits/main/bluesky/lexicons) are still subject to breaking | ||
> changes and may break at any moment if used in production code. Use at your own risk! | ||
### Installation | ||
|
||
In Xcode, select **File > Add Packages...** and enter https://github.com/christiandeange/BlueskyAPI. | ||
|
||
### Sample Usage | ||
|
||
```swift | ||
let api = XrpcBlueskyApi() | ||
let call = try await api.describeServer() | ||
switch onEnum(of: call) { | ||
case .success(let success): | ||
print(success.response) | ||
case .failure(let failure): | ||
print(failure.response ?? failure.error ?? failure) | ||
} | ||
``` | ||
|
||
Docs are available at [ozone.christian.sh](https://ozone.christian.sh). |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[libraries] | ||
bluesky = { module = "sh.christian.ozone:bluesky", version = "0.0.9" } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:recommended" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// swift-tools-version:5.3 | ||
import PackageDescription | ||
|
||
let remoteKotlinUrl = "{url}" | ||
let remoteKotlinChecksum = "{checksum}" | ||
let packageName = "BlueskyAPI" | ||
|
||
let package = Package( | ||
name: packageName, | ||
platforms: [ | ||
.iOS(.v13) | ||
], | ||
products: [ | ||
.library( | ||
name: packageName, | ||
targets: [packageName] | ||
), | ||
], | ||
targets: [ | ||
.binaryTarget( | ||
name: packageName, | ||
url: remoteKotlinUrl, | ||
checksum: remoteKotlinChecksum | ||
) | ||
, | ||
] | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
set -x | ||
|
||
ZIP_URL_TEMPLATE="https://repo1.maven.org/maven2/sh/christian/ozone/bluesky-kmmbridge/{version}/bluesky-kmmbridge-{version}.zip" | ||
|
||
if [[ -z "${1}" ]]; then | ||
echo "Usage: $0 <new-version>" >&2 | ||
exit 1 | ||
elif ! [[ "${1}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then | ||
echo "Error: '${1}' is not a valid semantic version." >&2 | ||
echo "Usage: $0 <new-version>" >&2 | ||
exit 1 | ||
fi | ||
|
||
NEXT_VERSION="${1-}" | ||
|
||
ZIP_URL="$(sed "s/{version}/$NEXT_VERSION/g" <<< "$ZIP_URL_TEMPLATE")" | ||
SHA_URL="${ZIP_URL}.sha256" | ||
|
||
CHECKSUM="$(curl -s $SHA_URL)" | ||
echo $CHECKSUM | ||
|
||
cp templates/Package.swift . | ||
|
||
if [ $(uname) == "Darwin" ]; then | ||
SP=" " # Needed for portability with sed | ||
fi | ||
sed -i${SP}'' "s|{url}|$ZIP_URL|g" Package.swift | ||
sed -i${SP}'' "s|{checksum}|$CHECKSUM|g" Package.swift |