Skip to content

Commit

Permalink
Tweak publication script
Browse files Browse the repository at this point in the history
  • Loading branch information
sampettersson committed Dec 8, 2022
1 parent a7fff6e commit 9e118f4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 5 deletions.
35 changes: 30 additions & 5 deletions .github/workflows/ios-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
with:
path: ~/.konan/
key: konan
- name: Get version
id: version
run: echo "number=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- uses: burrunan/gradle-cache-action@v1
name: Build XCFramework
env:
Expand All @@ -38,16 +41,38 @@ jobs:
job-id: publish-ci
concurrent: true
arguments: :assembleAuthlibReleaseXCFramework
- name: Make release
- name: Prepare ZIP
run: |
set -x
assets=()
set -x
zip -r ${{ github.workspace }}/build/XCFrameworks/release/authlib.xcframework.zip ${{ github.workspace }}/build/XCFrameworks/release/authlib.xcframework/*
function replaceChecksum {
CHECKSUM=$(swift package compute-checksum "$IOS_FOLDER"/build/"$1".xcframework.zip)
sed -i '' "s/checksum: \"[a-z0-9]*\"\/\/ $1 Checksum/checksum: \"$CHECKSUM\"\/\/ $1 Checksum/g" Package.swift
}
function replaceURL {
BASE_URL="https:\/\/github.com\/HedvigInsurance\/OdysseyKit\/raw\/$1"
sed -i '' "s/url: \".*\",\/\/ $2 URL/url: \"$BASE_URL\/$2.xcframework.zip\",\/\/ $2 URL/g" Package.swift
}
replaceChecksum "authlib"
replaceURL "${{ steps.version.outputs.number }}" "authlib"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Package.swift
uses: test-room-7/action-update-file@v1
with:
file-path: Package.swift
commit-msg: Update Package.swift
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Make release
run: |
set -x
for asset in ${{ github.workspace }}/build/XCFrameworks/release/*.zip; do
assets+=("-a" "$asset")
done
hub release create "${assets[@]}" -m "${{ github.ref }}" "${{ github.ref }}"
hub release create "${assets[@]}" -m "${{ steps.version.outputs.number }}" "${{ steps.version.outputs.number }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// swift-tools-version:5.7
import PackageDescription

let package = Package(
name: "authlib",
platforms: [
.iOS(.v14),
],
products: [
.library(
name: "authlib",
targets: ["authlib"]
)
],
dependencies: [],
targets: [
.binaryTarget(
name: "authlib",
url: "https://github.com/HedvigInsurance/authlib/releases/download/v0.0.0/authlib.xcframework.zip",// authlib URL
checksum: "7e1941c0aae7124180297c7580f62c2303701c9331fa19a389599b91cdb05032"// authlib Checksum
)
]
)

0 comments on commit 9e118f4

Please sign in to comment.