From 711d3e1f08240795647a46ac0882c2403627ed57 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Thu, 7 Apr 2022 15:55:39 +0530 Subject: [PATCH 1/6] workflow: Create workflow manifest for compiling mistserver --- .github/workflows/mistserver.yaml | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/mistserver.yaml diff --git a/.github/workflows/mistserver.yaml b/.github/workflows/mistserver.yaml new file mode 100644 index 000000000..743a798bb --- /dev/null +++ b/.github/workflows/mistserver.yaml @@ -0,0 +1,41 @@ +name: Build and release mist server binaries + +on: + push: + branches: + - "main" + - "hjp/*" + tags: + - "v*" + +jobs: + linux: + name: Build mist binaries for linux platform + runs-on: ubuntu-20.04 + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + path: 'livepeer-in-a-box' + fetch-depth: 0 + # Check https://github.com/livepeer/go-livepeer/pull/1891 + # for ref value discussion + ref: ${{ github.event.pull_request.head.sha }} + + - name: Check out mistserver code + uses: actions/checkout@v3 + with: + repository: DDVTECH/mistserver + path: 'mistserver' + fetch-depth: 0 + ref: livepeer-in-a-box + + - name: Compile mist binaries + shell: bash + run: | + cd livepeer-in-a-box/ + make mistserver + + # macos: + # name: Build mist binaries for macOS platform + # runs-on: macos-11 From 5af6fdbc81a39562f707167c493e17d0fd320022 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Thu, 7 Apr 2022 16:13:58 +0530 Subject: [PATCH 2/6] build/mistserver: Check in macos build job manifest --- .github/workflows/mistserver.yaml | 77 +++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mistserver.yaml b/.github/workflows/mistserver.yaml index 743a798bb..d5d7fccca 100644 --- a/.github/workflows/mistserver.yaml +++ b/.github/workflows/mistserver.yaml @@ -30,12 +30,83 @@ jobs: fetch-depth: 0 ref: livepeer-in-a-box + - name: Restore build cache + uses: actions/cache@v3 + with: + path: | + livepeer-in-a-box/build + key: ${{ runner.os }}-build-${{ hashFiles('**/Makefile') }} + restore-keys: | + ${{ runner.os }}-build- + + - name: Compile mist binaries + shell: bash + run: | + cd livepeer-in-a-box/ + make mistserver + + - name: Upload mist binaries as build artifacts + uses: actions/upload-artifact@master + with: + name: release-artifacts + path: livepeer-in-a-box/bin/ + + macos: + name: Build mist binaries for macOS platform + runs-on: macos-11 + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + path: 'livepeer-in-a-box' + fetch-depth: 0 + # Check https://github.com/livepeer/go-livepeer/pull/1891 + # for ref value discussion + ref: ${{ github.event.pull_request.head.sha }} + + - name: Check out mistserver code + uses: actions/checkout@v3 + with: + repository: DDVTECH/mistserver + path: 'mistserver' + fetch-depth: 0 + ref: livepeer-in-a-box + + - name: Restore build cache + uses: actions/cache@v3 + with: + path: | + livepeer-in-a-box/build + key: ${{ runner.os }}-build-${{ hashFiles('**/Makefile') }} + restore-keys: | + ${{ runner.os }}-build- + - name: Compile mist binaries shell: bash run: | cd livepeer-in-a-box/ make mistserver - # macos: - # name: Build mist binaries for macOS platform - # runs-on: macos-11 + # - uses: actions-ecosystem/action-regex-match@v2 + # id: match-tag + # with: + # text: ${{ github.ref_name }} + # regex: '^(master|main|v[0-9]+\.\d+\.\d+)$' + + - name: Codesign and notarize binaries + # if: ${{ steps.match-tag.outputs.match != '' }} + uses: livepeer/action-gh-codesign-apple@latest + with: + developer-certificate-id: ${{ secrets.CI_MACOS_CERTIFICATE_ID }} + developer-certificate-base64: ${{ secrets.CI_MACOS_CERTIFICATE_BASE64 }} + developer-certificate-password: ${{ secrets.CI_MACOS_CERTIFICATE_PASSWORD }} + app-notarization-email: ${{ secrets.CI_MACOS_NOTARIZATION_USER }} + app-notarization-password: ${{ secrets.CI_MACOS_NOTARIZATION_PASSWORD }} + binary-path: "livepeer-in-a-box/bin/" + app-bundle-id: "org.livepeer.mistserver" + + - name: Upload mist binaries as build artifacts + uses: actions/upload-artifact@master + with: + name: release-artifacts + path: livepeer-in-a-box/bin/ From c3a4e54369da9ca7d8172965fe78d42a4a20776c Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Thu, 7 Apr 2022 17:37:22 +0530 Subject: [PATCH 3/6] mistserver: Install coreutils for macos builds --- .github/workflows/mistserver.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mistserver.yaml b/.github/workflows/mistserver.yaml index d5d7fccca..d0d61d3e2 100644 --- a/.github/workflows/mistserver.yaml +++ b/.github/workflows/mistserver.yaml @@ -84,6 +84,7 @@ jobs: - name: Compile mist binaries shell: bash run: | + command -v brew && brew install coreutils cd livepeer-in-a-box/ make mistserver From f51ef91beb51aa4929b3ed69655a49b1f04b4b14 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Thu, 7 Apr 2022 18:07:31 +0530 Subject: [PATCH 4/6] mistserver: Archive mistserver binaries. --- .github/workflows/mistserver.yaml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mistserver.yaml b/.github/workflows/mistserver.yaml index d0d61d3e2..b7197e50b 100644 --- a/.github/workflows/mistserver.yaml +++ b/.github/workflows/mistserver.yaml @@ -43,13 +43,16 @@ jobs: shell: bash run: | cd livepeer-in-a-box/ + mkdir -p releases/ build/ bin/ make mistserver + cd bin/ + tar -czvf "../releases/livepeer-mistserver-linux-amd64.tar.gz" ./* - name: Upload mist binaries as build artifacts uses: actions/upload-artifact@master with: name: release-artifacts - path: livepeer-in-a-box/bin/ + path: livepeer-in-a-box/releases/ macos: name: Build mist binaries for macOS platform @@ -86,16 +89,19 @@ jobs: run: | command -v brew && brew install coreutils cd livepeer-in-a-box/ + mkdir -p releases/ build/ bin/ make mistserver + cd bin/ + tar -czvf "../releases/livepeer-mistserver-darwin-amd64.tar.gz" ./* - # - uses: actions-ecosystem/action-regex-match@v2 - # id: match-tag - # with: - # text: ${{ github.ref_name }} - # regex: '^(master|main|v[0-9]+\.\d+\.\d+)$' + - uses: actions-ecosystem/action-regex-match@v2 + id: match-tag + with: + text: ${{ github.ref_name }} + regex: '^(master|main|v[0-9]+\.\d+\.\d+)$' - name: Codesign and notarize binaries - # if: ${{ steps.match-tag.outputs.match != '' }} + if: ${{ steps.match-tag.outputs.match != '' }} uses: livepeer/action-gh-codesign-apple@latest with: developer-certificate-id: ${{ secrets.CI_MACOS_CERTIFICATE_ID }} @@ -110,4 +116,4 @@ jobs: uses: actions/upload-artifact@master with: name: release-artifacts - path: livepeer-in-a-box/bin/ + path: livepeer-in-a-box/releases/ From e4bc0a58f361ebfaaf6604c635d958432714a68e Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Thu, 7 Apr 2022 18:24:30 +0530 Subject: [PATCH 5/6] mistserver: Setup job to create a github release post successful build --- .github/workflows/mistserver.yaml | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.github/workflows/mistserver.yaml b/.github/workflows/mistserver.yaml index b7197e50b..a60d84593 100644 --- a/.github/workflows/mistserver.yaml +++ b/.github/workflows/mistserver.yaml @@ -117,3 +117,46 @@ jobs: with: name: release-artifacts path: livepeer-in-a-box/releases/ + + release: + name: Create release for mist binaries + runs-on: ubuntu-20.04 + needs: + - linux + - macos + steps: + - name: checkout + uses: actions/checkout@master + with: + fetch-depth: 0 + ref: ${{ github.event.workflow_run.head_branch }} + + - name: Download artifacts from build stages + uses: actions/download-artifact@v3 + with: + name: release-artifacts + path: releases/ + + - uses: actions-ecosystem/action-regex-match@v2 + id: match-tag + with: + text: ${{ github.event.workflow_run.head_branch }} + regex: '^v([0-9]+\.\d+\.\d+)$' + + - name: Generate sha256 checksum and gpg signatures for release artifacts + if: ${{ steps.match-tag.outputs.match != '' }} + uses: livepeer/action-gh-checksum-and-gpg-sign@latest + with: + artifacts-dir: releases + release-name: ${{ github.event.workflow_run.head_branch }} + gpg-key: ${{ secrets.CI_GPG_SIGNING_KEY }} + gpg-key-passphrase: ${{ secrets.CI_GPG_SIGNING_PASSPHRASE }} + + - name: Release to github + uses: softprops/action-gh-release@v1 + if: ${{ steps.match-tag.outputs.match != '' }} + with: + generate_release_notes: true + tag_name: ${{ github.event.workflow_run.head_branch }} + files: | + releases/* From 668b0d4573abc6a62a59edfa27f05bfc51f2a4b1 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Thu, 7 Apr 2022 18:37:47 +0530 Subject: [PATCH 6/6] mistserver: Fix `ref_name` when checking for a valid mist release. --- .github/workflows/mistserver.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/mistserver.yaml b/.github/workflows/mistserver.yaml index a60d84593..20f969ad3 100644 --- a/.github/workflows/mistserver.yaml +++ b/.github/workflows/mistserver.yaml @@ -4,9 +4,8 @@ on: push: branches: - "main" - - "hjp/*" tags: - - "v*" + - "mist-v*" jobs: linux: @@ -98,7 +97,7 @@ jobs: id: match-tag with: text: ${{ github.ref_name }} - regex: '^(master|main|v[0-9]+\.\d+\.\d+)$' + regex: '^(master|main|mist-v[0-9]+\.\d+\.\d+)$' - name: Codesign and notarize binaries if: ${{ steps.match-tag.outputs.match != '' }} @@ -131,24 +130,25 @@ jobs: fetch-depth: 0 ref: ${{ github.event.workflow_run.head_branch }} + - uses: actions-ecosystem/action-regex-match@v2 + id: match-tag + with: + text: ${{ github.ref_name }} + regex: '^mist-v([0-9]+\.\d+\.\d+)$' + - name: Download artifacts from build stages + if: ${{ steps.match-tag.outputs.match != '' }} uses: actions/download-artifact@v3 with: name: release-artifacts path: releases/ - - uses: actions-ecosystem/action-regex-match@v2 - id: match-tag - with: - text: ${{ github.event.workflow_run.head_branch }} - regex: '^v([0-9]+\.\d+\.\d+)$' - - name: Generate sha256 checksum and gpg signatures for release artifacts if: ${{ steps.match-tag.outputs.match != '' }} uses: livepeer/action-gh-checksum-and-gpg-sign@latest with: artifacts-dir: releases - release-name: ${{ github.event.workflow_run.head_branch }} + release-name: ${{ github.ref_name }} gpg-key: ${{ secrets.CI_GPG_SIGNING_KEY }} gpg-key-passphrase: ${{ secrets.CI_GPG_SIGNING_PASSPHRASE }}