Skip to content

Commit

Permalink
Migrate to GH actions (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
fzumstein authored Jul 5, 2022
1 parent e1912fb commit eccec5c
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 97 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build Pipeline

on:
# Run on all pushed commits, PRs and when a new release is created
# Prevents duplicate pipeline runs as a release also pushes a tag
pull_request:
push:
branches:
- '**'
tags-ignore:
- '**'
release:
types:
- created

jobs:
build:
# Prevent duplicate runs for own PRs
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: 'x64'
- name: Set version string
shell: bash
run: |
if [ ${GITHUB_REF::9} = "refs/tags" ]; then
version_string=${GITHUB_REF:10}
else
version_string=${GITHUB_SHA::7}
fi;
echo "VERSION_STRING=$(echo $version_string)" >> $GITHUB_ENV
- name: Get Certificate
id: write_file
uses: timheuer/base64-to-file@2d34558844bc851d6a653f79b3720f44dc6bff53
with:
fileName: 'cert.p12'
encodedString: ${{ secrets.CODESIGN_CERTIFICATE }}
- name: Set PATH for signtool
shell: bash
run: echo "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $GITHUB_PATH
- name: Install Python dependencies
run: |
pip install -r requirements.txt
- name: tests
run: |
python -m unittest discover src -vv
- name: Build Python Package
run: |
python .\scripts\windows\update-version-info.py
pyinstaller --onefile .\src\diff.py --name git-xl-diff-x64.exe --version-file .\scripts\windows\git-xl-version-info.py --icon .\scripts\windows\git-xl-logo.ico
mv dist\git-xl-diff-x64.exe git-xl-diff-x64.exe
pyinstaller --onefile .\src\cli.py --name git-xl-x64.exe --version-file .\scripts\windows\git-xl-version-info.py --icon .\scripts\windows\git-xl-logo.ico
mv dist\git-xl-x64.exe git-xl-x64.exe
- name: Sign exes and build installer
run: |
signtool sign /f ${{ steps.write_file.outputs.filePath }} /p ${{ secrets.CODESIGN_PASSWORD }} /tr http://timestamp.sectigo.com /td sha256 /fd SHA256 git-xl-*.exe
iscc scripts\windows\inno-setup-git-xl-installer.iss
mv git-xl-windows-0.0.0.exe dist\git-xl-windows-$env:VERSION_STRING.exe
signtool sign /f ${{ steps.write_file.outputs.filePath }} /p ${{ secrets.CODESIGN_PASSWORD }} /tr http://timestamp.sectigo.com /td sha256 /fd SHA256 dist\git-xl-windows-$env:VERSION_STRING.exe
- name: Upload artifacts (skipped for releases)
if: github.event_name != 'release'
uses: actions/upload-artifact@v1
with:
name: Installer
path: dist
- name: Upload Windows Installer to GitHub Release Page
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/git-xl-windows-${{ env.VERSION_STRING }}.exe
asset_name: git-xl-windows-${{ env.VERSION_STRING }}.exe
asset_content_type: application/zip
- name: Trigger Netlify webhook
if: github.event_name == 'release'
shell: bash
run: |
curl -X POST -d {} https://api.netlify.com/build_hooks/$NETLIFY_BUILD_HOOK
env:
NETLIFY_BUILD_HOOK: ${{ secrets.NETLIFY_BUILD_HOOK }}
80 changes: 0 additions & 80 deletions appveyor.yml

This file was deleted.

16 changes: 2 additions & 14 deletions scripts/windows/inno-setup-git-xl-installer.iss
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
#define MyAppName "Git XL"

#define PathToX86Binary "..\..\git-xl-x86.exe"
#ifnexist PathToX86Binary
#pragma error PathToX86Binary + " does not exist, please build it first."
#endif

#define PathToX64Binary "..\..\git-xl-x64.exe"
#ifnexist PathToX64Binary
#pragma error PathToX64Binary + " does not exist, please build it first."
#endif

#define PathToDiffX86Binary "..\..\git-xl-diff-x86.exe"
#ifnexist PathToDiffX86Binary
#pragma error PathToDiffX86Binary + " does not exist, please build it first."
#endif

#define PathToDiffX64Binary "..\..\git-xl-diff-x64.exe"
#ifnexist PathToDiffX64Binary
#pragma error PathToDiffX64Binary + " does not exist, please build it first."
#endif

; Arbitrarily choose the x86 executable here as both have the version embedded.
#define MyVersionInfoVersion GetFileVersion(PathToX86Binary)
#define MyVersionInfoVersion GetFileVersion(PathToX64Binary)

; Misuse RemoveFileExt to strip the 4th patch-level version number.
#define MyAppVersion RemoveFileExt(MyVersionInfoVersion)
Expand Down Expand Up @@ -66,9 +55,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Filename: "{code:GetExistingGitInstallation}\git-xl-uninstaller.exe"; Parameters: "/S"; Flags: skipifdoesntexist

[Files]
Source: {#PathToDiffX86Binary}; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-xl-diff.exe"; Check: not Is64BitInstallMode
Source: {#PathToDiffX64Binary}; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-xl-diff.exe"; Check: Is64BitInstallMode
Source: {#PathToX86Binary}; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-xl.exe"; Check: not Is64BitInstallMode
Source: {#PathToX64Binary}; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-xl.exe"; Check: Is64BitInstallMode

[Registry]
Expand Down Expand Up @@ -111,6 +98,7 @@ begin
if Is64BitInstallMode then
Result := Result + '\Git\mingw64\bin'
else
// TOOD: Support for 32-bit has been removed
Result := Result + '\Git\mingw32\bin';
end else begin
Result := ExtractFilePath(ExecStdOut);
Expand Down
Binary file removed scripts/windows/key.p12.enc
Binary file not shown.
9 changes: 6 additions & 3 deletions scripts/windows/update-version-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
base_directory = os.path.join('scripts', 'windows')

# read build number, repo tag name and git commit hash from env vars
build = os.getenv('APPVEYOR_BUILD_NUMBER', '0')
version = os.getenv('APPVEYOR_REPO_TAG_NAME', '0.0.0')
commit = os.environ['APPVEYOR_REPO_COMMIT'][:7] if os.getenv('APPVEYOR_REPO_COMMIT') else 'dev'
build = os.getenv('GITHUB_RUN_ATTEMPT', '0')
if os.getenv('GITHUB_REF_TYPE') == 'tag':
version = os.environ['GITHUB_REF_NAME']
else:
version = '0.0.0'
commit = os.environ['GITHUB_SHA'][:7] if os.getenv('GITHUB_SHA') else 'dev'

print('-----------')
print('Version tag: %s' % version)
Expand Down

0 comments on commit eccec5c

Please sign in to comment.