From 584caa753bed02e39a3354ab601a9565534fb18e Mon Sep 17 00:00:00 2001 From: trickart Date: Mon, 9 Dec 2024 17:16:40 +0900 Subject: [PATCH] Add release workflow. --- .github/workflows/release-artifact.yaml | 45 +++++++++++++++++++++++++ info.json.template | 18 ++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .github/workflows/release-artifact.yaml create mode 100644 info.json.template diff --git a/.github/workflows/release-artifact.yaml b/.github/workflows/release-artifact.yaml new file mode 100644 index 0000000..7c0bc16 --- /dev/null +++ b/.github/workflows/release-artifact.yaml @@ -0,0 +1,45 @@ +name: Release Artifact + +on: + push: + tags: + - '*.*.*' + +jobs: + release: + runs-on: macos-latest + + env: + DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer + ARTIFACT_BUNDLE: "LicensePlistsMerger.artifactbundle" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Show Xcode Version + run: xcodebuild -version + + - name: Build + run: swift build -c release --product license-plists-merger --arch arm64 --arch x86_64 + + - name: Set env + run: echo "ARTIFACT_BUNDLE_PATH"=${ARTIFACT_BUNDLE}/license-plists-merger-${{ github.ref_name }}-macos/bin >> $GITHUB_ENV + + - name: Create Artifact Bundle + run: | + mkdir -p "${ARTIFACT_BUNDLE_PATH}" + sed "s/__VERSION__/${{ github.ref_name }}/g" info.json.template > "${ARTIFACT_BUNDLE}/info.json" + cp -f .build/apple/Products/Release/license-plists-merger "${ARTIFACT_BUNDLE_PATH}"" + cp -f LICENSE "${ARTIFACT_BUNDLE_PATH}" + zip -yr - "${ARTIFACT_BUNDLE}" > "./license-plists-merger-macos.artifactbundle.zip" + + - name: Compute Checksum + run: | + CHECKSUM=$(swift package compute-checksum ./license-plists-merger-macos.artifactbundle.zip) + echo $CHECKSUM + echo "CHECKSUM=${CHECKSUM}" >> $GITHUB_ENV + + - name: Create release + run: | + gh release create "${{ github.ref_name}}" "./license-plists-merger-macos.artifactbundle.zip" -t "${{ github.ref_name }}" -n "**checksum**: ${{ env.CHECKSUM }}" diff --git a/info.json.template b/info.json.template new file mode 100644 index 0000000..9765c2b --- /dev/null +++ b/info.json.template @@ -0,0 +1,18 @@ +{ + "schemaVersion": "1.0", + "artifacts": { + "license-plists-merger": { + "version": "__VERSION__", + "type": "executable", + "variants": [ + { + "path": "license-plists-merger-__VERSION__-macos/bin/license-plists-merger", + "suportedTriples": [ + "x86_64-apple-macosx", + "arm64-apple-macosx" + ] + } + ] + } + } +}