-
Notifications
You must be signed in to change notification settings - Fork 16
66 lines (61 loc) · 2.49 KB
/
publish-spm.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Build, Tag and Create Release
on:
workflow_dispatch:
inputs:
version:
description: "New release version, eg. 0.MINOR.PATCH"
required: true
type: string
ffitag:
description: "The bdk-ffi tag to use for the release"
required: true
type: string
jobs:
build-publish:
name: Build, tag and create release
runs-on: macos-12
steps:
- name: "Checkout build repo"
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/bdk-ffi
path: build
ref: ${{ inputs.ffitag }}
- name: "Checkout dist repo"
uses: actions/checkout@v4
with:
path: dist
- name: "Create bdkFFI.xcframework"
working-directory: build/bdk-swift
run: |
# run the local script
./build-xcframework.sh
# remove old xcframework zip
rm bdkFFI.xcframework.zip || true
zip -9 -r bdkFFI.xcframework.zip bdkFFI.xcframework
echo "BDKFFICHECKSUM=`swift package compute-checksum bdkFFI.xcframework.zip`" >> $GITHUB_ENV
echo "BDKFFIURL=https\:\/\/github\.com\/${{ github.repository_owner }}\/bdk\-swift\/releases\/download\/${{ inputs.version }}\/bdkFFI\.xcframework\.zip" >> $GITHUB_ENV
- name: "Update and tag release dist repo"
working-directory: build/bdk-swift
run: |
echo checksum = ${{ env.BDKFFICHECKSUM }}
echo url = ${{ env.BDKFFIURL }}
sed "s/BDKFFICHECKSUM/${BDKFFICHECKSUM}/;s/BDKFFIURL/${BDKFFIURL}/" Package.swift.txt > ../../dist/Package.swift
cp Sources/BitcoinDevKit/BitcoinDevKit.swift ../../dist/Sources/BitcoinDevKit/BitcoinDevKit.swift
cp Sources/BitcoinDevKit/BitcoinDevKit.swift ../../dist/Sources/BitcoinDevKit/Bitcoin.swift
cd ../../dist
git add Sources/BitcoinDevKit/BitcoinDevKit.swift
git add Sources/BitcoinDevKit/Bitcoin.swift
git add Package.swift
git commit -m "Update BitcoinDevKit.swift and Package.swift for release ${{ inputs.version }}"
git push
git tag ${{ inputs.version }} -m "Release ${{ inputs.version }}"
git push --tags
- name: "Create release"
uses: ncipollo/release-action@v1
with:
artifacts: "build/bdk-swift/bdkFFI.xcframework.zip"
tag: ${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ inputs.version }}
prerelease: true