Skip to content

Commit

Permalink
Move away from git-lfs in favour of release artifacts (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbihel authored Jan 29, 2024
1 parent 0966fef commit 70f9709
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Tag in SemVer format'
required: true
type: string

jobs:
validation:
runs-on: ubuntu-latest
steps:
- name: Validate tag
run: |
echo "${{ github.event.inputs.version }}" | grep -P '^[0-9]+\.[0-9]+\.[0-9]+'
swift:
runs-on: macos-latest
needs: validation
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: "aarch64-apple-ios-sim,aarch64-apple-ios,x86_64-apple-ios"
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"

- uses: taiki-e/install-action@v2
with:
tool: cargo-swift

- name: Generate Swift package
run: cargo swift package -p ios -n WalletSdkRs --release

- name: Compress XCFramework
run: |
zip -9 -r RustFramework.xcframework.zip WalletSdkRs/RustFramework.xcframework
echo "XCF_CHECKSUM=`swift package compute-checksum RustFramework.xcframework.zip`" >> $GITHUB_ENV
- name: Update Swift Package definition
run: |
sed -i '' 's/.binaryTarget.*/.binaryTarget(name: "RustFramework", url: "https:\/\/github.com\/spruceid\/wallet-sdk-rs\/releases\/download\/${{ github.event.inputs.version }}\/RustFramework.xcframework.zip", checksum: "${{ env.XCF_CHECKSUM }}"),/' Package.swift
- name: Push changes and tag
run: |
git config user.name github-actions
git config user.email [email protected]
git add Package.swift
git commit -m "Release ${{ github.event.inputs.version }}"
git push
git tag ${{ github.event.inputs.version }} -m "${{ github.event.inputs.version }}"
git push --tags
- name: Create release and attach XCFramework binary artifact
uses: ncipollo/release-action@v1
with:
artifacts: "RustFramework.xcframework.zip"
tag: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/generated
.build
WalletSdkRs/Package.swift
WalletSdkRs/RustFramework
.swiftpm

0 comments on commit 70f9709

Please sign in to comment.