-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marcus Crane <marcus@utf9k.net>
- Loading branch information
1 parent
acd1b7f
commit f76e339
Showing
7 changed files
with
150 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Release October | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release: | ||
name: Release October (Windows Portable) | ||
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=windows-portable_amd64 | ||
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: '16' | ||
|
||
- 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 }} -ldflags "-X main.version=${{ github.event.release.tag_name }} -X main.portablebuild=true" | ||
|
||
- name: Codesign Windows Portable | ||
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.exe | ||
working-directory: ./build/bin | ||
|
||
- name: Compress binary | ||
run: Compress-Archive october.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/upload-release-asset@v1.0.2 | ||
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 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package backend | ||
|
||
import ( | ||
"os" | ||
"path" | ||
|
||
"github.com/adrg/xdg" | ||
) | ||
|
||
func LocateConfigFile(configFilename string, portable bool) (string, error) { | ||
if portable { | ||
cwd, err := os.Getwd() | ||
if err != nil { | ||
return "", err | ||
} | ||
return path.Join(cwd, configFilename), nil | ||
} | ||
return xdg.ConfigFile(configFilename) | ||
} | ||
|
||
func LocateDataFile(configFilename string, portable bool) (string, error) { | ||
if portable { | ||
cwd, err := os.Getwd() | ||
if err != nil { | ||
return "", err | ||
} | ||
return path.Join(cwd, configFilename), nil | ||
} | ||
return xdg.DataFile(configFilename) | ||
} |
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
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
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
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