Skip to content

Commit 8aa1a61

Browse files
committed
Reuse external action
1 parent 0edc07c commit 8aa1a61

File tree

2 files changed

+18
-77
lines changed

2 files changed

+18
-77
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,91 +3,23 @@ name: Binary Release
33
on:
44
push:
55
branches:
6-
- 'master'
6+
- "master"
77
paths:
8-
- '.version'
8+
- ".version"
99

1010
jobs:
1111
publish_binary_release:
1212
name: Publish binary release
1313
runs-on: macos-14
14+
timeout-minutes: 60
1415
steps:
16+
- uses: actions/checkout@v4
1517
- uses: maxim-lobanov/setup-xcode@v1
1618
with:
1719
xcode-version: "15.2"
18-
- uses: actions/checkout@v2
19-
- name: Build OpenSSL
20-
id: lib
21-
timeout-minutes: 60
22-
run: |
23-
source scripts/get-openssl-version.sh
24-
25-
COMPOUND_VERSION=`cat .version`
26-
OPENSSL_VERSION=${COMPOUND_VERSION%-*}
27-
SCRIPT_VERSION=${COMPOUND_VERSION#*-}
28-
TAG_NAME=$(get_openssl_version $OPENSSL_VERSION $SCRIPT_VERSION)
29-
30-
echo "Compiling OpenSSL $OPENSSL_VERSION"
31-
./build-libssl.sh --cleanup --version="$OPENSSL_VERSION"
32-
33-
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
34-
echo "openssl_version=$OPENSSL_VERSION" >> $GITHUB_OUTPUT
35-
echo "script_version=$SCRIPT_VERSION" >> $GITHUB_OUTPUT
36-
- name: Produce dynamic framework
37-
id: framework
38-
env:
39-
FRAMEWORK_DIR: "frameworks"
40-
FRAMEWORK: "openssl.xcframework"
41-
run: |
42-
./create-openssl-framework.sh
43-
( cd $FRAMEWORK_DIR && zip -yr $FRAMEWORK.zip $FRAMEWORK )
44-
45-
echo "artifact=$FRAMEWORK_DIR/$FRAMEWORK.zip" >> $GITHUB_OUTPUT
46-
- name: Import GPG key
47-
uses: crazy-max/ghaction-import-gpg@v4
48-
with:
49-
gpg_private_key: ${{ secrets.GPG_KEY }}
50-
passphrase: ${{ secrets.GPG_PASSPHRASE }}
51-
git_user_signingkey: true
52-
git_commit_gpgsign: true
53-
git_tag_gpgsign: true
54-
git_push_gpgsign: false
55-
- name: Update Package.swift
56-
id: package
57-
env:
58-
TAG_NAME: ${{ steps.lib.outputs.tag }}
59-
OPENSSL_VERSION: ${{ steps.lib.outputs.openssl_version }}
60-
SCRIPT_VERSION: ${{ steps.lib.outputs.script_version }}
61-
PACKAGE_METADATA: "Package.swift"
62-
PACKAGE_ARTIFACT: ${{ steps.framework.outputs.artifact }}
63-
PACKAGE_CHECKSUM: ${{ steps.framework.outputs.artifact }}.checksum
64-
run: |
65-
CHECKSUM=`swift package compute-checksum "$PACKAGE_ARTIFACT"`
66-
echo $CHECKSUM >$PACKAGE_CHECKSUM
67-
68-
sed -E "s@/[0-9\.]+/(openssl.xcframework.zip)@/$TAG_NAME/\\1@" $PACKAGE_METADATA |
69-
sed -E "s/checksum: \"[0-9a-f]+\"/checksum: \"$CHECKSUM\"/" >$PACKAGE_METADATA.tmp
70-
mv $PACKAGE_METADATA.tmp $PACKAGE_METADATA
71-
72-
RELEASE_NAME="OpenSSL $OPENSSL_VERSION"
73-
if [ $SCRIPT_VERSION -gt 0 ]; then
74-
RELEASE_NAME="$RELEASE_NAME ($SCRIPT_VERSION)"
75-
fi
76-
77-
git add $PACKAGE_METADATA
78-
git commit -m "$RELEASE_NAME"
79-
git tag "$TAG_NAME" -m "$RELEASE_NAME"
80-
git push && git push --tags
81-
82-
echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT
83-
echo "release_notes=$RELEASE_NOTES" >> $GITHUB_OUTPUT
84-
echo "checksum=$PACKAGE_CHECKSUM" >> $GITHUB_OUTPUT
85-
- name: Publish release
86-
uses: softprops/action-gh-release@v1
20+
- uses: passepartoutvpn/action-release-binary-package@master
8721
with:
88-
name: ${{ steps.package.outputs.release_name }}
89-
tag_name: ${{ steps.lib.outputs.tag }}
90-
generate_release_notes: true
91-
files: |
92-
${{ steps.framework.outputs.artifact }}
93-
${{ steps.package.outputs.checksum }}
22+
script: "ci-generate.sh"
23+
framework: "openssl.xcframework"
24+
gpg-key: ${{ secrets.GPG_KEY }}
25+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}

ci-generate.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
OPENSSL_VERSION="$1"
3+
FW_PATH="$2"
4+
5+
echo "Compiling OpenSSL $OPENSSL_VERSION"
6+
./build-libssl.sh --cleanup --version="$OPENSSL_VERSION"
7+
./create-openssl-framework.sh
8+
9+
mv frameworks/openssl.xcframework "$FW_PATH"

0 commit comments

Comments
 (0)