Skip to content

Commit

Permalink
full release workflow & fix swift release (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdtfh authored Nov 18, 2024
1 parent 932fe4d commit 93ddc0e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
name: Release

on:
workflow_dispatch: # TODO: Temporary for testing
release:
types: [created]

jobs:
# TODO: Implement me
update-cargo-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# TODO: Ensure tag is not repeated or older
- name: Validate release tag
id: validate-tag
run: |
TAG=${{ github.ref_name }}
SEMVER_REGEX="^[0-9]\.[0-9]{1,2}\.[0-9]{1,2}$"
if [[ ! $TAG =~ $SEMVER_REGEX ]]; then
echo "Tag $TAG does not match semantic versioning (MAJOR.MINOR.PATCH)."
exit 1
fi
echo "Tag $TAG is valid."
echo "release_tag=$TAG" >> $GITHUB_OUTPUT
- name: Set up Rust
run: |
rustup update stable && rustup default stable
- name: Install cargo-edit
run: cargo install cargo-edit

- name: Update version
run: cargo set-version --package walletkit-core ${{ steps.validate-tag.outputs.release_tag }}

- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add walletkit-core/Cargo.toml
git commit -m "Bump crate version to ${{ steps.validate-tag.outputs.release_tag }}"
git push
build-swift:
runs-on: macos-latest
needs: update-cargo-version
Expand Down Expand Up @@ -53,7 +86,7 @@ jobs:
cargo fetch
- name: Build the project (iOS)
run: swift/build_swift.sh
run: ./build_swift.sh

- name: Checkout swift repo
uses: actions/checkout@v4
Expand All @@ -65,7 +98,6 @@ jobs:
- name: Commit swift build
env:
GITHUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
# TODO: Bump relevant version in Package.swift and in commit message
run: |
cp -r WalletKitCore.xcframework target-repo/
cp -r Sources/ target-repo/
Expand All @@ -74,5 +106,9 @@ jobs:
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add .
git commit -m "Version release"
git commit -m "Release ${{ steps.validate-tag.outputs.release_tag }}"
# Tag the release
git tag ${{ steps.validate-tag.outputs.release_tag }}
git push
git push origin ${{ steps.validate-tag.outputs.release_tag }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
target/
.DS_Store
**/ios_build
.swiftpm/

# Swift build outputs are not commited to this repo.
WalletKitCore.xcframework/
Expand Down
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ let package = Package(
platforms: [
.iOS(.v13),
],
version: "0.0.1",
products: [
.library(
name: "WalletKitCore",
Expand Down

0 comments on commit 93ddc0e

Please sign in to comment.