This repository was archived by the owner on Nov 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (111 loc) · 3.97 KB
/
Copy pathbuild.yaml
File metadata and controls
123 lines (111 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Build Determined CLI
on:
push:
schedule:
- cron: '0 0 * * *' # Run every 24 hours
jobs:
build:
runs-on: windows-latest
permissions:
contents: write
env:
LATEST_TAG: ""
SKIP: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Check for new release
id: check_release
run: |
$latestDetermined = Invoke-RestMethod -Uri https://api.github.com/repos/determined-ai/determined/releases/latest
Write-Host "Latest Determined release is $($latestDetermined.tag_name)"
try {
$latestThisRepo = Invoke-RestMethod -Uri https://api.github.com/repos/${{ github.repository }}/releases/latest
Write-Host "Latest release for this repository is $($latestThisRepo.tag_name)"
} catch {
Write-Host "No release found for this repository"
$latestThisRepo = $null
}
if ($null -eq $latestThisRepo) {
Write-Host "First run"
echo "SKIP=false" >> $env:GITHUB_ENV
} elseif ($latestThisRepo.tag_name -eq $latestDetermined.tag_name) {
Write-Host "No new release"
echo "SKIP=true" >> $env:GITHUB_ENV
} else {
Write-Host "New release found"
echo "SKIP=false" >> $env:GITHUB_ENV
}
echo "LATEST_TAG=$($latestDetermined.tag_name)" >> $env:GITHUB_ENV
shell: powershell
- name: Clone and checkout new release
if: env.SKIP != 'true'
run: |
git clone https://github.com/determined-ai/determined.git
Set-Location -Path determined
Write-Host "Checking out $($env:LATEST_TAG)"
git checkout ${{ env.LATEST_TAG }}
shell: powershell
- name: Install dependencies
if: env.SKIP != 'true'
run: |
python -m pip install --upgrade pip
pip install determined
pip install pyinstaller
shell: powershell
- name: Build linked executable
if: env.SKIP != 'true'
run: |
Set-Location -Path determined/harness/determined/cli
pyinstaller --name det.exe __main__.py
shell: powershell
- name: Create zip file of linked executable
if: env.SKIP != 'true'
run: |
Set-Location -Path determined/harness/determined/cli/dist/det.exe/
Compress-Archive -Path * -DestinationPath determined-cli.zip
Move-Item -Path determined-cli.zip -Destination ../../../../../
shell: powershell
- name: Build static executable
if: env.SKIP != 'true'
run: |
Set-Location -Path determined/harness/determined/cli/
Remove-Item -Path dist -Recurse -Force
pyinstaller --name det.exe __main__.py --onefile
Move-Item -Path dist/det.exe -Destination ../../../
shell: powershell
- name: Create GitHub Release
id: create_release
if: env.SKIP != 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.LATEST_TAG }}
release_name: Release ${{ env.LATEST_TAG }}
body: New Determined AI Windows CLI build
draft: false
prerelease: false
- name: Upload zip file of linked executable
if: env.SKIP != 'true'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: determined/determined-cli.zip
asset_name: determined-cli.zip
asset_content_type: application/zip
- name: Upload exe file of static executable
if: env.SKIP != 'true'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: determined/det.exe
asset_name: det.exe
asset_content_type: application/exe