Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit fe74531

Browse files
authored
Setup Releases (#36)
1 parent 860c52e commit fe74531

File tree

2 files changed

+93
-2
lines changed

2 files changed

+93
-2
lines changed

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
versionType:
7+
description: "Version Type - Major, Minor, Patch, Manual"
8+
required: true
9+
default: patch
10+
type: choice
11+
options:
12+
- major
13+
- minor
14+
- patch
15+
- manual
16+
customVersion:
17+
description: "Custom Version - Use if Version Type is Manual"
18+
required: false
19+
20+
jobs:
21+
release:
22+
# validate if input was versionType = Major, Minor, Patch or Manual
23+
# if its Manual we require the `customVersion` value
24+
if: github.event.inputs.versionType != 'manual' || github.event.inputs.customVersion != null
25+
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 100
32+
fetch-tags: true
33+
34+
- name: Bump tag version
35+
id: bump_version
36+
run: |
37+
VERSION_TYPE=${{ github.event.inputs.versionType }}
38+
CUSTOM_VERSION=${{ github.event.inputs.customVersion }}
39+
if [[ "$VERSION_TYPE" == "manual" && -n "$CUSTOM_VERSION" ]]; then
40+
NEW_TAG=$CUSTOM_VERSION
41+
elif [[ "$VERSION_TYPE" == "major" || "$VERSION_TYPE" == "minor" || "$VERSION_TYPE" == "patch" ]]; then
42+
npm install -g semver
43+
LAST_TAG=$(git describe --match "[0-9]*.[0-9]*.[0-9]*" --tags --abbrev=0)
44+
NEW_TAG=$(semver -i $VERSION_TYPE $LAST_TAG)
45+
else
46+
echo "Invalid version type"
47+
exit 1
48+
fi
49+
echo "New version: $NEW_TAG"
50+
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
51+
52+
- name: Create GitHub Release
53+
uses: softprops/action-gh-release@v1
54+
with:
55+
tag_name: ${{ steps.bump_version.outputs.new_tag }}
56+
draft: false
57+
prerelease: true
58+
generate_release_notes: true

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,46 @@
66

77
> ⚠️ tbDEX SWIFT SDK IS CURRENTLY A WIP! ⚠️
88
9-
# Prerequisites
9+
## Prerequisites
1010

11-
## Cloning
11+
### Cloning
1212

1313
After cloning this repository, run:
14+
1415
```
1516
make bootstrap
1617
```
1718

1819
This will configure the repository's submodules properly, and ensure you're all set to go!
20+
21+
## Release Guidelines
22+
23+
### Pre-releases
24+
25+
With Swift Package Manager, pre-releases are not necessary as it can directly utilize the repository's revision or branch name. For instance, to test the current version of the tbDEX package, you can specify either:
26+
27+
```swift
28+
// Use the main branch
29+
.package(url: "https://github.com/TBD54566975/tbdex-swift.git", .branch("main")),
30+
31+
// Use a specific commit
32+
.package(url: "https://github.com/TBD54566975/tbdex-swift.git", .revision("28b3c865742f3b0cb9813f84e9c547425a06ac1d")),
33+
```
34+
35+
### Releasing New Versions
36+
37+
To release a new version, initiate the `Release` workflow:
38+
39+
1. Select the version type: `major`, `minor`, `patch`, or `manual`.
40+
41+
- For instance, if the latest version is `0.1.2`:
42+
- `major` will update to `1.0.0`
43+
- `minor` will update to `0.2.0`
44+
- `patch` will update to `0.1.3`
45+
- For `manual`, input the desired version in the Custom Version field, e.g., `0.9.0`
46+
47+
2. The workflow will automatically create a git tag and a GitHub release, including an automated changelog.
48+
49+
### Publishing Docs
50+
51+
API reference documentation is automatically updated and available at [https://swiftpackageindex.com/TBD54566975/tbdex-swift/{latest-version}/documentation/tbdex](https://swiftpackageindex.com/TBD54566975/tbdex-swift/main/documentation/tbdex) following each release.

0 commit comments

Comments
 (0)