Skip to content

Release October (Windows) #55

Release October (Windows)

Release October (Windows) #55

name: Release October (Windows)
on:
release:
types: [published]
jobs:
release:
name: Release October (Windows)
runs-on: windows-latest
strategy:
matrix:
platform:
- windows/amd64
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Normalise platform tag
id: normalise_platform
shell: bash
run: |
tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g')
echo "::set-output name=tag::$tag"
- name: Normalise version tag
id: normalise_version
shell: bash
run: |
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
echo "::set-output name=version::$version"
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Install makensis
uses: crazy-max/ghaction-chocolatey@v2
with:
args: install nsis
- name: Install wails
shell: bash
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: '20.8.0'
- name: Build frontend assets
shell: bash
run: |
npm install -g npm
node version.js ${{ github.event.release.tag_name }}
cd frontend && npm install
- name: Build Windows NSIS installer
shell: bash
run: CGO_ENABLED=1 wails build -platform ${{ matrix.platform }} -nsis -ldflags "-X main.version=${{ github.event.release.tag_name }}"
- name: Codesign Windows NSIS Installer
run: |
echo "Creating certificate file"
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
echo "Signing October installer"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' October-amd64-installer.exe
working-directory: ./build/bin
- name: Remove old October binary
shell: bash
run: rm October.exe
working-directory: ./build/bin
- name: Compress binary
run: Compress-Archive October-amd64-installer.exe october-${{ steps.normalise_platform.outputs.tag }}.zip
working-directory: ./build/bin
- name: Get latest release from API
id: get_upload_url
shell: bash
run: |
curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/marcus-crane/october/releases" > /tmp/releases.json
url=$(jq -r '.[0].upload_url' /tmp/releases.json)
echo "::set-output name=url::$url"
- name: Upload artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACT_NAME: october_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}
with:
upload_url: ${{ steps.get_upload_url.outputs.url }}
asset_path: ./build/bin/october-${{ steps.normalise_platform.outputs.tag }}.zip
asset_name: ${{ env.ARTIFACT_NAME }}.zip
asset_content_type: application/zip