feat: update release manager for create release archive for exr,.run_v01 #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Release on master | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| lint: | |
| if: false | |
| name: Lint Python Code (disabled) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "Linting skipped" | |
| release: | |
| name: Semantic Tag & GitHub Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine next version (semantic, avoid duplicates) | |
| id: version | |
| run: | | |
| latest=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
| echo "LATEST_TAG=$latest" >> $GITHUB_ENV | |
| IFS='.' read -r major minor patch <<< "${latest#v}" | |
| commit_msg=$(git log -1 --pretty=%s) | |
| echo "Latest commit message: $commit_msg" | |
| if [[ "$commit_msg" == feat:* ]]; then | |
| new_tag="v$major.$((minor+1)).0" | |
| else | |
| new_tag="v$major.$minor.$((patch+1))" | |
| fi | |
| git fetch --tags | |
| if git rev-parse "$new_tag" >/dev/null 2>&1; then | |
| echo "Tag $new_tag already exists. Bumping minor to avoid conflict..." | |
| new_tag="v$major.$((minor+1)).0" | |
| fi | |
| echo "NEW_TAG=$new_tag" >> $GITHUB_ENV | |
| echo "Final tag to use: $new_tag" | |
| - name: Create tag and push | |
| run: | | |
| git config user.name "Ripax" | |
| git config user.email "ripanbiswas007@gmail.com" | |
| git tag ${{ env.NEW_TAG }} | |
| git push https://x-access-token:${{ secrets.PERSONAL_TOKEN }}@github.com/${{ github.repository }} ${{ env.NEW_TAG }} | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| git log ${{ env.LATEST_TAG }}..HEAD --pretty=format:"- %s" > changelog.txt | |
| changelog=$(cat changelog.txt) | |
| # Escape % for GitHub output | |
| changelog="${changelog//'%'/'%25'}" | |
| changelog="${changelog//$'\n'/'%0A'}" | |
| changelog="${changelog//$'\r'/'%0D'}" | |
| echo "changelog=$changelog" >> $GITHUB_OUTPUT | |
| - name: Update CHANGELOG.md | |
| run: | | |
| DATE=$(date +'%Y-%m-%d') | |
| echo -e "## [${{ env.NEW_TAG }}] - $DATE\n$(cat changelog.txt)\n" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md | |
| git config user.name "Ripax" | |
| git config user.email "ripanbiswas007@gmail.com" | |
| git add CHANGELOG.md | |
| git commit -m "docs: update changelog for ${{ env.NEW_TAG }}" | |
| git push https://x-access-token:${{ secrets.PERSONAL_TOKEN }}@github.com/${{ github.repository }} master | |
| - name: Create release archives | |
| run: | | |
| # Get Git-tracked files (newline-separated) | |
| git ls-files > git_files.txt | |
| # Find all .exr and .run files (newline-separated, relative paths) | |
| find . -type f \( -iname "*.exr" -o -iname "*.run" \) > extra_files.txt | |
| # Combine and deduplicate | |
| cat git_files.txt extra_files.txt | sort | uniq > all_files.txt | |
| # Archive | |
| zip -@ release-${{ env.NEW_TAG }}.zip < all_files.txt | |
| tar -czf release-${{ env.NEW_TAG }}.tar.gz --files-from=all_files.txt | |
| - name: Publish GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ env.NEW_TAG }} | |
| body: ${{ steps.changelog.outputs.changelog }} | |
| files: | | |
| release-${{ env.NEW_TAG }}.zip | |
| release-${{ env.NEW_TAG }}.tar.gz | |
| *.EXR | |
| *.exr | |
| *.run | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }} |