diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 99bf80c..c448f58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,9 +3,9 @@ name: Binary Release on: push: branches: - - 'master' + - "master" paths: - - '.version' + - ".version" env: FRAMEWORK_ARTIFACT: "wg-go.xcframework" @@ -13,83 +13,13 @@ env: jobs: publish_binary_release: name: Publish binary release + timeout-minutes: 10 runs-on: macos-14 steps: - uses: actions/checkout@v4 - - uses: maxim-lobanov/setup-xcode@v1 + - uses: passepartoutvpn/action-release-binary-package@v1 with: - xcode-version: "15.2" - - uses: actions/setup-go@v5 - with: - go-version: "stable" - - name: Build framework - id: framework - timeout-minutes: 10 - run: | - COMPOUND_VERSION=`cat .version` - - LIBRARY_VERSION=${COMPOUND_VERSION%-*} - LIBRARY_MINOR=${LIBRARY_VERSION%.*} - LIBRARY_PATCH=${LIBRARY_VERSION##*.} - - SCRIPT_VERSION=${COMPOUND_VERSION#*-} - - MERGED_PATCH=$((($LIBRARY_PATCH + 1) * 100 + $SCRIPT_VERSION)) - TAG_NAME="$LIBRARY_MINOR.$MERGED_PATCH" - - ./build-platforms.sh - ./create-framework.sh - - echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT - echo "library_version=$LIBRARY_VERSION" >> $GITHUB_OUTPUT - echo "script_version=$SCRIPT_VERSION" >> $GITHUB_OUTPUT - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - git_user_signingkey: true - git_commit_gpgsign: true - git_tag_gpgsign: true - git_push_gpgsign: false - - name: Update package - id: package - env: - TAG_NAME: ${{ steps.framework.outputs.tag }} - LIBRARY_VERSION: ${{ steps.framework.outputs.library_version }} - SCRIPT_VERSION: ${{ steps.framework.outputs.script_version }} - PACKAGE_ZIP: ${{ env.FRAMEWORK_ARTIFACT }}.zip - PACKAGE_CHECKSUM: ${{ env.FRAMEWORK_ARTIFACT }}.zip.checksum - PACKAGE_METADATA: "Package.swift" - run: | - zip -yr "$PACKAGE_ZIP" "$FRAMEWORK_ARTIFACT" - - CHECKSUM=`swift package compute-checksum "$PACKAGE_ZIP"` - echo $CHECKSUM >$PACKAGE_CHECKSUM - - sed -E "s@/[0-9\.]*/(${PACKAGE_ZIP})@/${TAG_NAME}/\\1@" $PACKAGE_METADATA | - sed -E "s/checksum: \"[0-9a-f]*\"/checksum: \"${CHECKSUM}\"/" >$PACKAGE_METADATA.tmp - mv $PACKAGE_METADATA.tmp $PACKAGE_METADATA - - RELEASE_NAME="$LIBRARY_VERSION" - if [ $SCRIPT_VERSION -gt 0 ]; then - RELEASE_NAME="$RELEASE_NAME ($SCRIPT_VERSION)" - fi - - git add $PACKAGE_METADATA - git commit -m "$RELEASE_NAME" - git tag "$TAG_NAME" -m "$RELEASE_NAME" - git push && git push --tags - - echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT - echo "zip=$PACKAGE_ZIP" >> $GITHUB_OUTPUT - echo "checksum=$PACKAGE_CHECKSUM" >> $GITHUB_OUTPUT - - name: Publish release - uses: softprops/action-gh-release@v2 - with: - name: ${{ steps.package.outputs.release_name }} - tag_name: ${{ steps.framework.outputs.tag }} - generate_release_notes: true - files: | - ${{ steps.package.outputs.zip }} - ${{ steps.package.outputs.checksum }} + script: "ci-generate.sh" + framework: "wg-go.xcframework" + gpg-key: ${{ secrets.GPG_KEY }} + gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} diff --git a/.version b/.version index 7f49a70..6f5247a 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.0.19-4 +1.0.19-5 diff --git a/Package.swift b/Package.swift index 0bb8405..50e5a48 100644 --- a/Package.swift +++ b/Package.swift @@ -14,8 +14,8 @@ let package = Package( targets: [ .binaryTarget( name: "wg-go", - url: "https://github.com/passepartoutvpn/wg-go-apple/releases/download/1.0.2004/wg-go.xcframework.zip", - checksum: "91eee47e6e38587b4367654124ccc433caa42c8568800a058383ce65ffcb88ba" + url: "https://github.com/passepartoutvpn/wg-go-apple/releases/download/0.0.613/wg-go.xcframework.zip", + checksum: "613125fb66ebd6246c1a913ea98c993131a698c4e3251ba5ea8834ac17f9cda8" ) // // local development diff --git a/ci-generate.sh b/ci-generate.sh new file mode 100755 index 0000000..612bf40 --- /dev/null +++ b/ci-generate.sh @@ -0,0 +1,3 @@ +#!/bin/bash +./build-platforms.sh +./create-framework.sh $1 diff --git a/create-framework.sh b/create-framework.sh index f495e7c..a5d3803 100755 --- a/create-framework.sh +++ b/create-framework.sh @@ -1,6 +1,10 @@ #!/bin/bash +if [[ -z $1 ]]; then + echo "Provide an output" + exit 1 +fi PLATFORMS_PATH="build" -FRAMEWORK_PATH="wg-go.xcframework" +FRAMEWORK_PATH="$1" PLATFORMS=("iphoneos" "iphonesimulator" "macosx" "appletvos" "appletvsimulator") for ARG in ${PLATFORMS[@]}; do diff --git a/update-package.sh b/update-package.sh deleted file mode 100755 index ac4ba77..0000000 --- a/update-package.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -if [[ -z $1 ]]; then - echo "Provide a tag" - exit 1 -fi - -TAG_NAME="$1" -FRAMEWORK_PATH="wg-go.xcframework" -MANIFEST="Package.swift" - -zip -yr "$FRAMEWORK_PATH.zip" "$FRAMEWORK_PATH" -CHECKSUM=`swift package compute-checksum $FRAMEWORK_PATH.zip` - -sed -E "s@/[0-9\.]*/($FRAMEWORK_PATH.zip)@/$TAG_NAME/\\1@" $MANIFEST | sed -E "s/checksum: \"[0-9a-f]*\"/checksum: \"$CHECKSUM\"/" >$MANIFEST.tmp -mv $MANIFEST.tmp $MANIFEST