Skip to content

Merge pull request #734 from IAHispano/formatter/main #102

Merge pull request #734 from IAHispano/formatter/main

Merge pull request #734 from IAHispano/formatter/main #102

Workflow file for this run

name: Release
on:
push:
branches:
- main
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v4.7.1
with:
python-version: "3.8"
- name: Detect and tag new version
id: check-version
uses: salsify/action-detect-and-tag-new-version@v2.0.3
with:
tag-template: '{VERSION}'
version-command: |
bash -o pipefail -c "cat ./assets/config.json | jq -r '.version'"
- name: Create CHANGELOG.md
if: steps.check-version.outputs.tag
run: |
cd /home/runner/work/Applio/Applio
cat > CHANGELOG.md << EOF
## Important Installation Guidelines
### Before You Install Applio
Please review these essential instructions to ensure a smooth installation:
- **File Location**: Place the Applio files in a dedicated folder on your C drive.
- **Access Control**: Avoid placing Applio in folders that require elevated privileges.
- **Administrator Rights**: Do not run the \`run-install.bat\` script with administrator privileges.
- **Path Requirements**: Ensure the installation path is free of spaces or special characters.
- **Security Settings**: Temporarily disable your antivirus and firewall to prevent any issues with missing dependencies during installation.
### Installation Steps
1. **Download**: Get the .zip file from [this link](https://github.com/IAHispano/Applio/archive/refs/tags/${{ steps.check-version.outputs.tag }}.zip).
2. **Run the Installer**: Extract the files and execute the \`run-install.bat\` script.
3. **Start Applio**: Launch Applio by running the \`run-applio.bat\` script.
### Prefer a Simpler Installation?
> [!TIP]
> For the best experience, we highly recommend using the pre-compiled version. Compiling the code yourself may lead to instabilities.
- **Download Compiled Version**: Get the zip from [this link](https://huggingface.co/IAHispano/Applio/resolve/main/Compiled/Windows/ApplioV${{ steps.check-version.outputs.tag }}.zip).
- **Run Applio**: Extract the `.zip` file, then open the \`run-applio.bat\` file.
**Full Changelog**: https://github.com/IAHispano/Applio/compare/${{ steps.check-version.outputs.previous-version }}...${{ steps.check-version.outputs.tag }}
EOF
- name: Get commit history
if: steps.check-version.outputs.tag
run: |
previous_tag="${{ steps.check-version.outputs.previous-version }}"
echo "Previous Tag: $previous_tag"
commit_data=$(curl -s "https://api.github.com/repos/IAHispano/Applio/commits?sha=$previous_tag&per_page=1" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}")
if [[ "$commit_data" == "[]" ]]; then
echo "No commits found for tag $previous_tag. Using current date."
commit_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
else
commit_date=$(echo "$commit_data" | jq -r '.[0].commit.committer.date')
fi
echo "Fetching commits since: $commit_date"
curl -s "https://api.github.com/repos/IAHispano/Applio/commits?since=$commit_date&per_page=600" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
| jq -r '.[] | .sha + " " + .commit.message' > commits.txt
cat commits.txt
- name: Summarize changelog with Groq API
if: steps.check-version.outputs.tag
id: summarize-changelog
run: |
changelog=$(cat commits.txt)
json_payload=$(jq -n \
--arg content "$changelog" \
'{
messages: [
{
role: "system",
content: "You will receive a commit history. Your task is to extract and present the top 20% most relevant changes as a concise list, each item preceded by a bullet point (-). Each entry should be as brief as possible, ideally 1 to 4 words, summarizing the key updates and enhancements. Ignore changes related to .yml files, Git Keep, chore(format), \"colab,\" \"Major fix,\" and phrases like \"Updating Files\" or similar cases (e.g., \"Update Applio (train.py, preprocess.py, core.py)\"). Summarization Rules: Summarize commits like Update ___.py, Fix _____.py, Disable, Delete, or Merge as \"Fixing Code Issues\" and include specific details in parentheses only if they refer to a specific feature, module, or file name. For entries starting with \"Add,\" \"Fix,\" \"Improving,\" \"Improve,\" \"Rework,\" \"Update,\" or \"Updating,\" ensure they are merged into a single entry, with specific details included in parentheses. Ensure the details within parentheses are concise and directly relevant to the change, focusing on the affected feature or module. If multiple commits fall under \"Fixing Code Issues,\" consolidate them into one entry, mentioning only the major areas or modules affected without listing every specific fix. If the commit is related to \"tab\" or \"UI,\" merge it under \"Improving Code\" and include specific details in parentheses if necessary. Replace entries that use phrases like \"Updating Files\" or similar detailed updates (e.g., \"Update Applio (train.py, preprocess.py, core.py)\") with a summary of the actual changes or enhancements made, focusing on the specific impact or feature. Eliminate duplicates by merging similar entries into a single summary where possible. Ensure each entry is distinct and avoids repetition of similar details or terminology. Final Checks: After generating the list, review it to identify and merge any similar entries or duplicates. Ensure that each entry is concise, distinct, and free of redundancy. Limit the list to a maximum of 5 items. Each entry should start with an uppercase letter. Exclude any entries that include \"Major fix\" and ignore them if found. Note: Do not include any commentary or additional text; return only the list. This prompt could be improved by adding examples of commit messages and their expected summaries to provide clearer guidance."
},
{
role: "user",
content: $content
}
],
model: "llama-3.1-70b-versatile",
temperature: 0.6,
max_tokens: 600,
top_p: 1,
stream: false,
stop: null
}')
echo "json_payload: $json_payload"
curl "https://api.groq.com/openai/v1/chat/completions" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.GROQ_API_KEY }}" \
-d "$json_payload" \
| jq -r '.choices[0].message.content' > summarized_changelog.txt
- name: Set up Node.js
if: steps.check-version.outputs.tag
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install gh-release
if: steps.check-version.outputs.tag
run: |
npm install https://github.com/IAHispano/gh-release.git
- name: Create package.json
if: steps.check-version.outputs.tag
run: |
cd /home/runner/work/Applio/Applio
echo '{}' > package.json
jq \
--arg version "${{ steps.check-version.outputs.tag }}" \
--arg url "git+https://github.com/IAHispano/Applio.git" \
'. + {version: $version, repository: {url: $url}}' \
package.json > tmp.$$.json && mv tmp.$$.json package.json
cat package.json
- name: Publish release
if: steps.check-version.outputs.tag
run: |
cd /home/runner/work/Applio/Applio && \
tag_name="${{ steps.check-version.outputs.tag }}"
changelog=$(cat summarized_changelog.txt)
GH_RELEASE_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} npx gh-release \
-t "${tag_name}" \
-n "Applio ${tag_name}" \
-c "main" \
-b "## Important Installation Guidelines
### Before You Install Applio
Please review these essential instructions to ensure a smooth installation:
- **File Location**: Place the Applio files in a dedicated folder on your C drive.
- **Access Control**: Avoid placing Applio in folders that require elevated privileges.
- **Administrator Rights**: Do not run the \`run-install.bat\` script with administrator privileges.
- **Path Requirements**: Ensure the installation path is free of spaces or special characters.
- **Security Settings**: Temporarily disable your antivirus and firewall to prevent any issues with missing dependencies during installation.
### Installation Steps
1. **Download**: Get the .zip file from [this link](https://github.com/IAHispano/Applio/archive/refs/tags/${{ steps.check-version.outputs.tag }}.zip).
2. **Run the Installer**: Extract the files and execute the \`run-install.bat\` script.
3. **Start Applio**: Launch Applio by running the \`run-applio.bat\` script.
### Prefer a Simpler Installation?
> [!TIP]
> For the best experience, we highly recommend using the pre-compiled version. Compiling the code yourself may lead to instabilities.
- **Download Compiled Version**: Get the zip from [this link](https://huggingface.co/IAHispano/Applio/resolve/main/Compiled/Windows/ApplioV${{ steps.check-version.outputs.tag }}.zip).
- **Run Applio**: Extract the `.zip` file, then open the \`run-applio.bat\` file.
## What's New in This Release
${changelog}
**Full Changelog**: https://github.com/IAHispano/Applio/compare/${{ steps.check-version.outputs.previous-version }}...${{ steps.check-version.outputs.tag }} " \
-o "IAHispano" \
-r "Applio" \
-w /home/runner/work/Applio/Applio \
-y
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Trigger Pre-Compiled
if: steps.check-version.outputs.tag
uses: actions/github-script@v6
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'pre_compiled.yml',
ref: context.ref,
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}