Skip to content

Build, Tag and Create Release #32

Build, Tag and Create Release

Build, Tag and Create Release #32

Workflow file for this run

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