Github Release #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# release package | |
name: Github Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
build-binaries: | |
runs-on: macos-latest | |
permissions: | |
contents: read | |
id-token: write | |
strategy: | |
matrix: | |
arch: [x64,arm64] | |
platform: [linux,macos,win] | |
exclude: | |
- platform: win # need to debug it | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: depot/setup-action@v1 | |
with: | |
oidc: true | |
- name: Build using Docker (with depot) | |
run: mkdir preevy-bin && depot build --project ${{ vars.DEPOT_PROJECT_ID }} --build-arg CLI_TARGET=${{ matrix.platform }}-${{ matrix.arch }} -f Dockerfile.cli --target=cli --output=type=tar,dest=./preevy-bin/preevy-${{ matrix.platform }}-${{ matrix.arch }}.tar --progress=plain --platform=linux/${{ matrix.arch == 'x64' && 'amd64' || matrix.arch }} . | |
- name: Sign mac binaries | |
if: ${{ matrix.platform == 'macos' }} | |
env: | |
CERT_DATA: ${{ secrets.APPLE_CERT_DATA }} | |
CERT_PASS: ${{ secrets.APPLE_CERT_PASS }} | |
CERT_CN: ${{ vars.APPLE_CERT_CN }} | |
run: | | |
tar -xf ./preevy-bin/preevy-${{ matrix.platform }}-${{ matrix.arch }}.tar | |
codesign --remove-signature ./preevy | |
echo $CERT_DATA | base64 --decode > certificate.p12 | |
security create-keychain -p actions build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p actions build.keychain | |
security set-keychain-settings -t 3600 -l ~/Library/Keychains/build.keychain | |
security import certificate.p12 -k ~/Library/Keychains/build.keychain -P "${{ secrets.CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign | |
security find-identity -v | |
codesign --keychain build.keychain --sign $CERT_CN ./preevy | |
security delete-keychain build.keychain | |
rm certificate.p12 | |
tar -cf ./preevy-bin/preevy-${{ matrix.platform }}-${{ matrix.arch }}.tar ./preevy | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: preevy-bin | |
path: ./preevy-bin/** | |
release: | |
runs-on: ubuntu-latest | |
needs: build-binaries | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: depot/setup-action@v1 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: preevy-bin | |
path: ./preevy-bin | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
draft: true # ${{ !startsWith(github.ref, 'refs/tags/') }} | |
prerelease: true # ${{ !startsWith(github.ref, 'refs/tags/') }} | |
files: | | |
./preevy-bin/** |