Retry without working-directory #167
This file contains hidden or 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: Release October | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: | |
- 'main' | |
release: | |
types: [published] | |
jobs: | |
release: | |
continue-on-error: true | |
strategy: | |
fail-fast: false # Build all other releases if a single one fails | |
matrix: | |
build: | |
- platform: darwin/amd64 | |
os: macos-latest | |
tag: darwin_amd64 | |
- platform: darwin/arm64 | |
os: macos-latest | |
tag: darwin_arm64 | |
- platform: darwin/universal | |
os: macos-latest | |
tag: darwin_universal | |
- arch: amd64 | |
platform: linux/amd64 | |
os: ubuntu-22.04 | |
tag: linux_amd64_webkit2gtk40 | |
- arch: amd64 | |
platform: linux/amd64 | |
os: ubuntu-latest | |
tag: linux_amd64 | |
- arch: arm64 | |
platform: linux/arm64 | |
os: buildjet-4vcpu-ubuntu-2204-arm | |
tag: linux_arm64_webkit2gtk40 | |
- arch: arm64 | |
platform: linux/arm64 | |
os: buildjet-4vcpu-ubuntu-2204-arm | |
tag: linux_arm64 | |
- arch: amd64 | |
platform: windows/amd64 | |
os: windows-latest | |
tag: windows_amd64 | |
- arch: amd64 | |
platform: windows/amd64 | |
os: windows-latest | |
tag: windows-portable_amd64 | |
runs-on: ${{ matrix.build.os }} | |
name: Release October (${{ matrix.build.tag }}) | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
# Set up common, sanitised environment variables | |
- name: Normalise version tag | |
id: normalise_version | |
shell: bash | |
run: | | |
if [ -n "${{ github.event.release.tag_name }}" ]; then | |
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g') | |
else | |
version="1.0.0" | |
fi | |
echo "version=$version" >> $GITHUB_OUTPUT | |
# Set up development dependencies | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 # github.com/glebarez/sqlite appears incompatible with 1.24 | |
- name: Install wails | |
shell: bash | |
run: go install github.com/wailsapp/wails/v2/cmd/[email protected] | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '23.11.0' | |
# Dependencies | |
## Linux (webkit2gtk-4.0) | |
- name: Install Ubuntu prerequisites | |
if: runner.os == 'Linux' && contains(matrix.build.tag, 'webkit2gtk40') | |
shell: bash | |
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev | |
## Linux (webkit2gtk-4.1) | |
- name: Install Ubuntu prerequisites | |
if: runner.os == 'Linux' && !contains(matrix.build.tag, 'webkit2gtk40') | |
shell: bash | |
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev | |
## macOS | |
- name: Setup Gon | |
if: runner.os == 'macOS' | |
run: brew install Bearer/tap/gon | |
- name: Import code signing certificate from Github Secrets | |
uses: Apple-Actions/import-codesign-certs@v3 | |
if: runner.os == 'macOS' | |
with: | |
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | |
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} | |
## Windows | |
- name: Setup Java for CodeSignTool | |
if: runner.os == 'Windows' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Download and Setup CodeSignTool | |
if: runner.os == 'Windows' | |
run: | | |
New-Item -Path "C:\" -Name "Runner" -ItemType "Directory" | |
curl -o "C:\Runner\CodeSignTool.zip" https://www.ssl.com/download/codesigntool-for-windows/ | |
cd "C:\Runner\" | |
Expand-Archive -Path CodeSignTool.zip | |
Get-ChildItem -Force -Path "C:\Runner\CodeSignTool" | |
- name: Validate if CodeSignTool is executable | |
if: runner.os == 'Windows' | |
run: | | |
echo "Testing file existence and properties..." | |
dir "C:\Runner\CodeSignTool\CodeSignTool.bat" | |
echo "Trying to type the file..." | |
type "C:\Runner\CodeSignTool\CodeSignTool.bat" | |
shell: cmd | |
- name: Install Windows dependencies | |
if: runner.os == 'Windows' | |
uses: crazy-max/ghaction-chocolatey@v3 | |
with: | |
args: install nsis | |
# Build -- frontend | |
- name: Build frontend assets | |
shell: bash | |
run: | | |
npm install -g npm | |
node version.js "v${{ steps.normalise_version.outputs.version }}" | |
cd frontend && npm install | |
# Build -- app variants | |
## Linux (webkit2gtk-4.0) -- We explicitly set 4.0 in this tag because it'll only be less used over time | |
- name: Build wails app for Linux (webkit2gtk-4.0) | |
if: runner.os == 'Linux' && contains(matrix.build.tag, 'webkit2gtk40') | |
shell: bash | |
run: wails build -platform ${{ matrix.build.platform }} -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}" | |
## Linux (webkit2gtk-4.1) -- We set this as the new default as more users will use 24.0x+ over time | |
- name: Build wails app for Linux (webkit2gtk-4.1) | |
if: runner.os == 'Linux' && !contains(matrix.build.tag, 'webkit2gtk40') | |
shell: bash | |
run: wails build -platform ${{ matrix.build.platform }} -tags webkit2_41 -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}" | |
## macOS | |
- name: Build wails app for macOS | |
if: runner.os == 'macOS' | |
shell: bash | |
run: wails build -platform ${{ matrix.build.platform }} -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}" | |
## Windows | |
- name: Build Windows NSIS installer (Normal) | |
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64' | |
shell: bash | |
run: wails build -platform ${{ matrix.build.platform }} -nsis -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}" -windowsconsole | |
- name: Build Windows NSIS installer (Portable) | |
if: runner.os == 'Windows' && matrix.build.tag == 'windows-portable_amd64' | |
shell: bash | |
run: wails build -platform ${{ matrix.build.platform }} -nsis -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }} -X main.portablebuild=true" -windowsconsole | |
# Codesigning (only performed when releases are cut + pushes to main for validation) | |
## macOS | |
- name: Notarise macOS app + create dmg | |
if: runner.os == 'macOS' && (startsWith(github.ref, 'refs/tags/') || github.ref_name == 'main') | |
shell: bash | |
run: gon -log-level=info gon.config.json | |
env: | |
AC_USERNAME: ${{ secrets.AC_USERNAME }} | |
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} | |
AC_PROVIDER: "6RNEAKRYDT" | |
## Windows | |
- name: Codesign Windows NSIS Installer | |
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64' && (startsWith(github.ref, 'refs/tags/') || github.ref_name == 'main') | |
run: '"C:\Runner\CodeSignTool\CodeSignTool.bat" sign -credential_id="${{ secrets.ESIGNER_CREDENTIAL_ID }}" -username="${{ secrets.ESIGNER_USERNAME }}" -password="${{ secrets.ESIGNER_PASSWORD }}" -totp_secret="${{ secrets.ESIGNER_TOTP_SECRET }}" -input_file_path="October-${{ matrix.build.arch }}-installer.exe"' | |
shell: cmd | |
working-directory: ./build/bin | |
- name: Codesign Windows Portable | |
if: runner.os == 'Windows' && matrix.build.tag == 'windows-portable_amd64' && (startsWith(github.ref, 'refs/tags/') || github.ref_name == 'main') | |
run: '"C:\Runner\CodeSignTool\CodeSignTool.bat" sign -credential_id="${{ secrets.ESIGNER_CREDENTIAL_ID }}" -username="${{ secrets.ESIGNER_USERNAME }}" -password="${{ secrets.ESIGNER_PASSWORD }}" -totp_secret="${{ secrets.ESIGNER_TOTP_SECRET }}" -input_file_path="october.exe"' | |
shell: cmd | |
working-directory: ./build/bin | |
# Packaging | |
## Linux | |
- name: Package up deb file | |
if: runner.os == 'Linux' | |
shell: bash | |
run: | | |
mv build/bin/october build/linux/october_0.0.0_ARCH/usr/local/bin/ | |
cd build/linux | |
sed -i 's/0.0.0/${{ steps.normalise_version.outputs.version }}/g' "october_0.0.0_ARCH/DEBIAN/control" | |
sed -i 's/ARCH/${{ matrix.build.arch }}/g' "october_0.0.0_ARCH/DEBIAN/control" | |
mv october_0.0.0_ARCH "october_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.arch }}" | |
dpkg-deb --build "october_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.arch }}" | |
- name: Compress deb | |
if: runner.os == 'Linux' | |
shell: bash | |
run: | | |
cd build/linux && zip -r october-${{ matrix.build.tag }}.zip october_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.arch }}.deb | |
mv october-${{ matrix.build.tag }}.zip ../bin | |
## macOS | |
- name: Compress macOS dmg | |
if: runner.os == 'macOS' && (startsWith(github.ref, 'refs/tags/') || github.ref_name == 'main') | |
shell: bash | |
run: cd build/bin && zip -r october-${{ matrix.build.tag }}.zip October.dmg | |
- name: Compress macOS app | |
if: ${{ runner.os == 'macOS' && !startsWith(github.ref, 'refs/tags/') }} | |
shell: bash | |
run: cd build/bin && zip -r october-${{ matrix.build.tag }}.zip October.app | |
## Windows | |
- name: Remove old October binary | |
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64' | |
shell: bash | |
run: rm October.exe | |
working-directory: ./build/bin | |
- name: Compress binary (Win Normal) | |
if: runner.os == 'Windows' && matrix.build.tag == 'windows_amd64' | |
run: Compress-Archive October-${{ matrix.build.arch }}-installer.exe october-${{ matrix.build.tag }}.zip | |
working-directory: ./build/bin | |
- name: Compress binary (Win Portable) | |
if: runner.os == 'Windows' && matrix.build.tag == 'windows-portable_amd64' | |
run: Compress-Archive october.exe october-${{ matrix.build.tag }}.zip | |
working-directory: ./build/bin | |
- name: Upload build artifact | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: october_pr${{ github.event.pull_request.number }}_${{ github.event.pull_request.head.sha }}_${{ matrix.build.tag }}.zip | |
path: | | |
./build/bin | |
- name: Get latest release from API | |
if: startsWith(github.ref, 'refs/tags/') | |
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 "url=$url" >> $GITHUB_OUTPUT | |
- name: Upload artifact | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ARTIFACT_NAME: october_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.tag }} | |
with: | |
upload_url: ${{ steps.get_upload_url.outputs.url }} | |
asset_path: ./build/bin/october-${{ matrix.build.tag }}.zip | |
asset_name: ${{ env.ARTIFACT_NAME }}.zip | |
asset_content_type: application/zip |