This commit is contained in:
Yadciel 2023-05-12 12:09:57 +02:00
parent 207fd7e7ca
commit 5fb1308bd6
2 changed files with 66 additions and 2 deletions

View File

@ -38,10 +38,11 @@ def start():
if player1.rect.colliderect(tanken.rect):
if player1.Tank < 250:
player1.Tank += 0.1
player1.Tank += 0.5
if player1.rect.colliderect(enemy.rect):
gameover = 'gameover'
if player1.Erz > 0:
player1.Erz -= 1
if player1.rect.colliderect(erzmine.rect):
player1.Erz += 1

View File

@ -1,6 +1,13 @@
pipeline {
agent {
label 'python' // Uses the Jenkins agent with the label 'python'
}
environment {
GITEA_API_URL = "https://git.braveslave.duckdns.org/api/v1"
GITEA_ACCESS_TOKEN = credentials('9afe425f01f873c384e4454f00ee38110057de30')
OWNER = "Yadciel"
REPO = "LF08"
FILE_PATH = "C:/Program Files/jenkins-agent/workspace/TS/dist"
}
stages {
stage('Build') {
@ -24,5 +31,61 @@ pipeline {
"""
}
}
stage('Check for Release Tag') {
steps {
script {
def response = sh(returnStdout: true, script: "git describe --tags --exact-match HEAD")
if (response.trim() == "") {
error("No release tag found on the latest commit.")
}
env.RELEASE_TAG = response.trim()
}
}
}
stage('Create Release') {
when {
expression { env.RELEASE_TAG != null }
}
steps {
script {
def payload = [
tag_name: env.RELEASE_TAG,
name: "Release ${env.RELEASE_TAG}"
]
def response = httpRequest(
url: "${env.GITEA_API_URL}/repos/${env.OWNER}/${env.REPO}/releases?access_token=${env.GITEA_ACCESS_TOKEN}",
httpMode: 'POST',
contentType: 'APPLICATION_JSON',
requestBody: new groovy.json.JsonBuilder(payload).toString()
)
if (response.status != 201) {
error("Failed to create release: ${response.content}")
}
def releaseId = new groovy.json.JsonSlurper().parseText(response.content).id
env.RELEASE_ID = releaseId.toString()
}
}
}
stage('Upload File') {
when {
expression { env.RELEASE_ID != null }
}
steps {
script {
def response = httpRequest(
url: "${env.GITEA_API_URL}/repos/${env.OWNER}/${env.REPO}/releases/${env.RELEASE_ID}/assets?access_token=${env.GITEA_ACCESS_TOKEN}",
httpMode: 'POST',
contentType: 'APPLICATION_OCTET_STREAM',
requestBody: new File(env.FILE_PATH)
)
if (response.status != 201) {
error("Failed to upload file: ${response.content}")
}
echo "File uploaded successfully!"
}
}
}
}
}