Windows Executable Release #63
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
name: Windows Executable Release | |
on: | |
workflow_dispatch: | |
env: | |
FORMULA_NAME: 'twilio' | |
jobs: | |
get-sha: | |
runs-on: macos-latest | |
outputs: | |
SHA_SHORT: ${{steps.get-sha.outputs.SHA_SHORT}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Getting latest sha | |
id: get-sha | |
run: echo "::set-output name=SHA_SHORT::$(git rev-parse --short HEAD)" | |
get-tag: | |
runs-on: macos-latest | |
outputs: | |
TAG_NAME: ${{steps.get-tag.outputs.TAG_NAME}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Getting latest tag | |
id: get-tag | |
run: | | |
git fetch --prune --unshallow | |
echo "::set-output name=TAG_NAME::$(git describe --tags $(git rev-list --tags --max-count=1))" | |
pack-windows-release: | |
runs-on: macos-latest | |
needs: [get-tag, get-sha] | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
make install | |
brew install makensis | |
npx oclif pack:win | |
- name: upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{env.FORMULA_NAME}}-${{ needs.get-tag.outputs.TAG_NAME }}.exe | |
path: dist/win32/${{env.FORMULA_NAME}}-v${{ needs.get-tag.outputs.TAG_NAME }}-${{ needs.get-sha.outputs.SHA_SHORT }}-x86.exe | |
retention-days: 1 | |
sign-windows-release: | |
needs: [pack-windows-release, get-tag, get-sha] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: make install | |
- name: import certificate | |
if: ${{ github.repository_owner == 'twilio' }} | |
run: | | |
New-Item -ItemType directory -Path certificate | |
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WINDOWS_CERTIFICATE }}' | |
certutil -decode certificate\certificate.txt certificate\certificate.pfx | |
- name: import Executable | |
id: download | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{env.FORMULA_NAME}}-${{ needs.get-tag.outputs.TAG_NAME }}.exe | |
- name: 'Echo download path' | |
run: ls ${{steps.download.outputs.download-path}} | |
- name: Code Sign The Executable | |
if: ${{ github.repository_owner == 'twilio' }} | |
run: | | |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.WINDOWS_CERTIFICATE_PASS }}' /t http://timestamp.digicert.com ${{steps.download.outputs.download-path}}/${{env.FORMULA_NAME}}-v${{ needs.get-tag.outputs.TAG_NAME }}-${{ needs.get-sha.outputs.SHA_SHORT }}-x86.exe | |
- name: Upload binaries to release | |
run: node .github/scripts/update-platform-executables.js | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FILE: ${{steps.download.outputs.download-path}}\${{env.FORMULA_NAME}}-v${{ needs.get-tag.outputs.TAG_NAME }}-${{ needs.get-sha.outputs.SHA_SHORT }}-x86.exe | |
ASSET_NAME: ${{env.FORMULA_NAME}}-${{ needs.get-tag.outputs.TAG_NAME }}.exe | |
TAG_NAME: ${{ needs.get-tag.outputs.TAG_NAME }} | |
REPO_NAME: ${{ github.repository }} | |
notify-complete-fail: | |
if: ${{ failure() || cancelled() }} | |
needs: [sign-windows-release ] | |
name: Notify Release Failed | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Slack Notification | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.ALERT_SLACK_WEB_HOOK }} | |
SLACK_COLOR: "#ff3333" | |
SLACK_USERNAME: CLI Release Bot | |
SLACK_ICON_EMOJI: ":ship:" | |
SLACK_TITLE: "Twilio Cli" | |
SLACK_MESSAGE: 'Windows Executable Release Failed' | |
MSG_MINIMAL: actions url |