Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

full release workflow & fix swift release #6

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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