init
This commit is contained in:
commit
f938b45fe8
80
.gitea/workflows/closeMilestoneIssues.yaml
Normal file
80
.gitea/workflows/closeMilestoneIssues.yaml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
name: Close Milestone Issues
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
repo:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
milestone:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
jobs:
|
||||||
|
close_issues:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: List and close issues
|
||||||
|
run: |
|
||||||
|
GITEA_API_URL="https://gitea.greyhound-software.com/api/v1"
|
||||||
|
OWNER="greyhound"
|
||||||
|
API_TOKEN=${{ vars.PAT_TOKEN }}
|
||||||
|
|
||||||
|
NEW_LABEL_ID="32"
|
||||||
|
FILTER_LABEL_ID="37"
|
||||||
|
|
||||||
|
# Fetch milestones from the repository
|
||||||
|
milestones=$(curl -s -H "Authorization: token $API_TOKEN" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones")
|
||||||
|
|
||||||
|
# Extract the ID of the ${{ inputs.milestone }} milestone
|
||||||
|
update_milestone_id=$(echo "$milestones" | jq '.[] | select(.title == "${{ inputs.milestone }}") | .id')
|
||||||
|
|
||||||
|
if [ -z "$update_milestone_id" ]; then
|
||||||
|
echo "No milestone named '${{ inputs.milestone }}' found. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reading the Issues with the given Milestone
|
||||||
|
echo "Milestone Id '$update_milestone_id'"
|
||||||
|
echo "Reading issues with Url '$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/issues?state=open&milestone=$update_milestone_id'"
|
||||||
|
issues=$(curl -s -H "Authorization: token $API_TOKEN" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/issues?state=open&milestones=$update_milestone_id")
|
||||||
|
|
||||||
|
for issue_number in $(echo "$issues" | jq -r '.[].number'); do
|
||||||
|
echo "Processing issue #$issue_number"
|
||||||
|
|
||||||
|
# Debug: Output the full response for the current issue
|
||||||
|
issue_details=$(curl -s -H "Authorization: token $API_TOKEN" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/issues/$issue_number")
|
||||||
|
echo "Issue details: $issue_details"
|
||||||
|
|
||||||
|
# Get the current labels for the issue (now correctly parsing the JSON structure)
|
||||||
|
current_labels=$(echo "$issue_details" | jq '[.labels[].id]')
|
||||||
|
|
||||||
|
# Check if the issue has the specific label you're filtering by
|
||||||
|
has_filter_label=$(echo "$current_labels" | jq --argjson filter_label $FILTER_LABEL_ID 'index($filter_label) != null')
|
||||||
|
|
||||||
|
if [ "$has_filter_label" = "true" ]; then
|
||||||
|
echo "Issue #$issue_number has the label $FILTER_LABEL_ID and milestone ${{ inputs.milestone }}"
|
||||||
|
|
||||||
|
# Debug: Output current labels
|
||||||
|
echo "Current labels for issue #$issue_number: $current_labels"
|
||||||
|
|
||||||
|
# Update the issue
|
||||||
|
updateResponse=$(curl -s -X PATCH -H "Authorization: token $API_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"state\": \"closed\"}" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/issues/$issue_number")
|
||||||
|
echo "ISSUE update response: $updateResponse"
|
||||||
|
|
||||||
|
# Update the issue labels
|
||||||
|
labelResponse=$(curl -s -X POST -H "Authorization: token $API_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"labels\": [$NEW_LABEL_ID]}" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/issues/$issue_number/labels")
|
||||||
|
|
||||||
|
echo "ISSUE Label update response code: $labelResponse"
|
||||||
|
else
|
||||||
|
echo "Issue #$issue_number does not have the label $FILTER_LABEL_ID, skipping..."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
58
.gitea/workflows/milestoneRenameAndRecreate.yaml
Normal file
58
.gitea/workflows/milestoneRenameAndRecreate.yaml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
name: Milestone Rename
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
repo:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
currentName:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
newName:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
jobs:
|
||||||
|
rename:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Rename
|
||||||
|
run: |
|
||||||
|
GITEA_API_URL="https://gitea.greyhound-software.com/api/v1"
|
||||||
|
OWNER="greyhound"
|
||||||
|
API_TOKEN=${{ vars.PAT_TOKEN }}
|
||||||
|
|
||||||
|
# Fetch milestones from the repository
|
||||||
|
milestones=$(curl -s -H "Authorization: token $API_TOKEN" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones")
|
||||||
|
|
||||||
|
# Extract the ID of the ${{ inputs.currentName }} milestone
|
||||||
|
update_milestone_id=$(echo "$milestones" | jq '.[] | select(.title == "${{ inputs.currentName }}") | .id')
|
||||||
|
|
||||||
|
if [ -z "$update_milestone_id" ]; then
|
||||||
|
echo "No milestone named '${{ inputs.currentName }}' found. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Found '${{ inputs.currentName }}' milestone with ID: $update_milestone_id"
|
||||||
|
|
||||||
|
echo "Rename the '${{ inputs.currentName }}' milestone to '${{ inputs.newName }}"
|
||||||
|
new_name="${{ inputs.newName }}"
|
||||||
|
milestone_update=$(curl -s -X PATCH -H "Authorization: token $API_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"title\": \"$new_name\", \"state\": \"closed\"}" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones/$update_milestone_id")
|
||||||
|
|
||||||
|
echo "Renamed '${{ inputs.currentName }}' milestone to $new_name: $milestone_update"
|
||||||
|
|
||||||
|
# Create a new milestone named "${{ inputs.currentName }}"
|
||||||
|
|
||||||
|
milestone_data=$(jq -n \
|
||||||
|
--arg title "${{ inputs.currentName }}" \
|
||||||
|
'{"title": $title}')
|
||||||
|
|
||||||
|
response=$(curl -s -X POST -H "Authorization: token $API_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$milestone_data" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones")
|
||||||
|
|
||||||
|
echo "Created new '${{ inputs.currentName }}' milestone: $response"
|
43
.gitea/workflows/parseVersion.yaml
Normal file
43
.gitea/workflows/parseVersion.yaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: Parse Version Number
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
outputs:
|
||||||
|
major:
|
||||||
|
description: "Major number"
|
||||||
|
value: ${{ jobs.parse.outputs.major }}
|
||||||
|
minor:
|
||||||
|
description: "Minor number"
|
||||||
|
value: ${{ jobs.parse.outputs.minor }}
|
||||||
|
patch:
|
||||||
|
description: "Patch number"
|
||||||
|
value: ${{ jobs.parse.outputs.patch }}
|
||||||
|
build:
|
||||||
|
description: "Build number"
|
||||||
|
value: ${{ jobs.parse.outputs.build }}
|
||||||
|
jobs:
|
||||||
|
parse:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
major: ${{ steps.parseStep.outputs.major }}
|
||||||
|
minor: ${{ steps.parseStep.outputs.minor }}
|
||||||
|
patch: ${{ steps.parseStep.outputs.patch }}
|
||||||
|
build: ${{ steps.parseStep.outputs.build }}
|
||||||
|
steps:
|
||||||
|
- id: parseStep
|
||||||
|
run: |
|
||||||
|
VERSION="${{ inputs.version }}"
|
||||||
|
VERSION="${VERSION#refs/tags/}"
|
||||||
|
IFS='.' read -r major minor patch build <<< "$VERSION"
|
||||||
|
|
||||||
|
if [ -z "$build" ]; then
|
||||||
|
build="0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "major=$major" >> $GITHUB_OUTPUT
|
||||||
|
echo "minor=$minor" >> $GITHUB_OUTPUT
|
||||||
|
echo "patch=$patch" >> $GITHUB_OUTPUT
|
||||||
|
echo "build=$build" >> $GITHUB_OUTPUT
|
30
.gitea/workflows/setPackageVersion.yaml
Normal file
30
.gitea/workflows/setPackageVersion.yaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
name: Set Package Version
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
branch:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
jobs:
|
||||||
|
SetVersion:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set
|
||||||
|
run: |
|
||||||
|
echo "Setting Version to ${{ inputs.version }}"
|
||||||
|
npm version --no-git-tag-version ${{ inputs.version }}
|
||||||
|
- name: Commit version change
|
||||||
|
run: |
|
||||||
|
git config user.name "${{ vars.GIT_DEPLOY_NAME }}"
|
||||||
|
git config user.email "${{ vars.GIT_DEPLOY_MAIL }}"
|
||||||
|
git add package.json
|
||||||
|
git commit -m "Update package.json version to $TAG_VERSION"
|
||||||
|
|
||||||
|
- name: Push changes back to repository
|
||||||
|
run: |
|
||||||
|
git push origin HEAD:${{ inputs.branch }}
|
97
.gitea/workflows/updateRelease.yaml
Normal file
97
.gitea/workflows/updateRelease.yaml
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
name: Update Release
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
milestoneName:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
repo:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
artifactName:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
fileName:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
jobs:
|
||||||
|
UpdateRelease:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Load Artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.artifactName }}
|
||||||
|
path: ./
|
||||||
|
|
||||||
|
- name: Get Release
|
||||||
|
run: |
|
||||||
|
GITEA_API_URL="https://gitea.greyhound-software.com/api/v1"
|
||||||
|
OWNER="greyhound"
|
||||||
|
API_TOKEN=${{ vars.PAT_TOKEN }}
|
||||||
|
|
||||||
|
# Fetch Release
|
||||||
|
release=$(curl -s -H "Authorization: token $API_TOKEN" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/releases/tags/${{ inputs.version }}")
|
||||||
|
|
||||||
|
# Extract the ID of the Release
|
||||||
|
release_id=$(echo $release | jq -r '.id')
|
||||||
|
|
||||||
|
if [ "$release_id" == "null" ]; then
|
||||||
|
echo "No release for tag '${{ inputs.version }}' found. Exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Found tag '${{ inputs.version }}' release with ID: $release_id"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
milestones=$(curl -s -H "Authorization: token $API_TOKEN" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/milestones")
|
||||||
|
|
||||||
|
echo "Milestones: $milestones."
|
||||||
|
|
||||||
|
# Extract the ID of the ${{ inputs.milestoneName }} milestone
|
||||||
|
update_milestone_id=$(echo "$milestones" | jq '.[] | select(.title == "${{ inputs.milestoneName }}") | .id')
|
||||||
|
|
||||||
|
if [ "$update_milestone_id" != "null" ]; then
|
||||||
|
echo "Milestone named '${{ inputs.milestoneName }}' found with id $update_milestone_id."
|
||||||
|
|
||||||
|
description="https://gitea.greyhound-software.com/$OWNER/${{ inputs.repo }}/milestone/$update_milestone_id"
|
||||||
|
|
||||||
|
release_update=$(curl -s -X PATCH -H "Authorization: token $API_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"body\": \"$description\", \"name\": \"${{ inputs.milestoneName }}\"}" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/releases/$release_id")
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
artifact_file="./${{ inputs.fileName }}"
|
||||||
|
artifact_name=$(basename "$artifact_file")
|
||||||
|
|
||||||
|
echo "Checking artifact '$artifact_file'"
|
||||||
|
if [ -f "$artifact_file" ]; then
|
||||||
|
echo "Uploading artifact '$artifact_name' to release $release_id..."
|
||||||
|
|
||||||
|
upload_response=$(curl -s -o response.json -w "%{http_code}" -X POST \
|
||||||
|
-H "Authorization: token $API_TOKEN" \
|
||||||
|
-H "Content-Type: multipart/form-data" \
|
||||||
|
-F "name=$artifact_name" \
|
||||||
|
-F "attachment=@$artifact_file" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/releases/$release_id/assets")
|
||||||
|
|
||||||
|
http_code=$(echo "$upload_response" | tail -n1) # Last line is the HTTP code
|
||||||
|
if [ "$http_code" -ne 201 ]; then
|
||||||
|
echo "Artifact upload failed with HTTP code: $http_code"
|
||||||
|
echo "Response: $(cat response.json)"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Artifact uploaded successfully."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Artifact file '$artifact_file' not found. Exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
45
.gitea/workflows/uploadArtifactWithFtp.yaml
Normal file
45
.gitea/workflows/uploadArtifactWithFtp.yaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
name: Upload artifact With Ftp
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
artifactName:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
fileName:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
uploadName:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
ftpPath:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
txtFileContent:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
txtFileName:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
jobs:
|
||||||
|
UploadFtp:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Load Artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.artifactName }}
|
||||||
|
path: ./
|
||||||
|
- name: Upload
|
||||||
|
run: |
|
||||||
|
upload_name=${{ inputs.fileName }}
|
||||||
|
|
||||||
|
if [ "${{ inputs.uploadName }}" != "" ]; then
|
||||||
|
echo "Renaming file to ${{ inputs.uploadName }}"
|
||||||
|
mv ${{ inputs.fileName }}" ${{ inputs.uploadName }}"
|
||||||
|
upload_name=${{ inputs.uploadName }}
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -T ./$upload_name ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}"
|
||||||
|
|
||||||
|
printf "%b" "${{ inputs.txtFileContent }}" > ${{ inputs.txtFileName }}
|
||||||
|
curl -T ./${{ inputs.txtFileName }} ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}"
|
Loading…
Reference in New Issue
Block a user