Merge branch 'main' of https://gitea.stanleysolutionsnw.com/Potlatch-Loggers/ComputerKeeper
All checks were successful
Potlatch Loggers Organization/ComputerKeeper/pipeline/head This commit looks good
All checks were successful
Potlatch Loggers Organization/ComputerKeeper/pipeline/head This commit looks good
This commit is contained in:
commit
9b96667b8d
14
Jenkinsfile
vendored
14
Jenkinsfile
vendored
@ -21,9 +21,17 @@ node ('windows') {
|
|||||||
bat """pyinstaller --noconfirm --onefile --windowed "./main.py" """
|
bat """pyinstaller --noconfirm --onefile --windowed "./main.py" """
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap Up - Archive the Generated Executables, Tear Down the Build System.
|
// Wrap Up - Archive the Generated Executables
|
||||||
stage('Archive/Teardown') {
|
stage('Archive') {
|
||||||
archiveArtifacts artifacts: "dist\\*.exe"
|
// Provide Credentials to Upload to Gitea
|
||||||
|
withCredentials([
|
||||||
|
usernamePassword(credentialsId: 'gitea-jenkinsbot',
|
||||||
|
usernameVariable: 'GITEA_USER',
|
||||||
|
passwordVariable: 'GITEA_PASS')
|
||||||
|
]) {
|
||||||
|
// Publish the Latest
|
||||||
|
bat "python publish_package.py"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
11
README.md
11
README.md
@ -2,16 +2,21 @@
|
|||||||
*a tool to manage a library of computers for Potlatch Jr/Sr High School*
|
*a tool to manage a library of computers for Potlatch Jr/Sr High School*
|
||||||
|
|
||||||
|
|
||||||
### Build System:
|
### Build System
|
||||||
Builds are generated by Stanley Solutions Jenkins; they can be accessed here: [StanleySolutions Jenkins](https://jenkins.stanleysolutionsnw.com/job/Potlatch%20Loggers%20Organization/job/ComputerKeeper/)
|
Builds are generated by Stanley Solutions Jenkins; they can be accessed here:
|
||||||
|
[StanleySolutions Jenkins](https://jenkins.stanleysolutionsnw.com/job/Potlatch%20Loggers%20Organization/job/ComputerKeeper/)
|
||||||
|
|
||||||
| **Branch** | **Build Status** |
|
| **Branch** | **Build Status** |
|
||||||
|------------|------------------|
|
|------------|------------------|
|
||||||
| Main | [![Master Branch Build Status](https://jenkins.stanleysolutionsnw.com/buildStatus/icon?job=Potlatch+Loggers+Organization%2FComputerKeeper%2Fmain)](https://jenkins.stanleysolutionsnw.com/job/Potlatch%20Loggers%20Organization/job/ComputerKeeper/job/main/) |
|
| Main | [![Master Branch Build Status](https://jenkins.stanleysolutionsnw.com/buildStatus/icon?job=Potlatch+Loggers+Organization%2FComputerKeeper%2Fmain)](https://jenkins.stanleysolutionsnw.com/job/Potlatch%20Loggers%20Organization/job/ComputerKeeper/job/main/) |
|
||||||
|
|
||||||
|
|
||||||
|
### Built Resources
|
||||||
|
Resulting EXE files built by Jenkins are archived as packages and can be found
|
||||||
|
in the [repository packages](https://gitea.stanleysolutionsnw.com/Potlatch-Loggers/ComputerKeeper/packages).
|
||||||
|
|
||||||
## PyInstaller Command
|
## PyInstaller Command
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pyinstaller --noconfirm --onefile --windowed "./main.py"
|
pyinstaller --noconfirm --onefile --windowed "./main.py"
|
||||||
```
|
```
|
||||||
|
47
publish_package.py
Normal file
47
publish_package.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
################################################################################
|
||||||
|
"""
|
||||||
|
Publish the EXE as a package to Gitea.
|
||||||
|
"""
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
|
||||||
|
OWNER = "Potlatch-Loggers"
|
||||||
|
PKG_NAME = "ComputerKeeper-BUILD"
|
||||||
|
PKG_VERSION = "latest"
|
||||||
|
FILE_NAME = "main.exe"
|
||||||
|
|
||||||
|
AUTH_USER = os.getenv("GITEA_USER")
|
||||||
|
AUTH_PASS = os.getenv("GITEA_PASS")
|
||||||
|
|
||||||
|
HOST = "https://gitea.stanleysolutionsnw.com"
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Attempt Deleting the Package, then Add the New Package with File."""
|
||||||
|
s = requests.Session()
|
||||||
|
s.auth = (AUTH_USER, AUTH_PASS)
|
||||||
|
# Delete Package
|
||||||
|
try:
|
||||||
|
print("Deleting...")
|
||||||
|
result = s.delete(
|
||||||
|
f"{HOST}/api/packages/{OWNER}/generic/{PKG_NAME}/{PKG_VERSION}"
|
||||||
|
)
|
||||||
|
result.raise_for_status()
|
||||||
|
# pylint: disable=broad-except
|
||||||
|
except Exception:
|
||||||
|
# Intentionally Overlook Issues Here
|
||||||
|
print("No package to delete.")
|
||||||
|
# Add New Package
|
||||||
|
print("Adding new package...")
|
||||||
|
result = s.put(
|
||||||
|
(
|
||||||
|
f"{HOST}/api/packages/{OWNER}/generic/{PKG_NAME}/{PKG_VERSION}/" +
|
||||||
|
FILE_NAME
|
||||||
|
),
|
||||||
|
data=open(f"dist/{FILE_NAME}", 'rb').read(),
|
||||||
|
)
|
||||||
|
result.raise_for_status()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user