Bump version to 2.0.2 #57
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: Build Kora Icon Theme RPM | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| build-rpm: | |
| runs-on: ubuntu-latest | |
| container: fedora:latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Need full history for version calculation | |
| - name: Install build dependencies | |
| run: | | |
| dnf install -y rpm-build rpmdevtools git jq curl | |
| - name: Set up RPM build environment | |
| run: | | |
| rpmdev-setuptree | |
| - name: Determine version | |
| id: version | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Base version components | |
| MAJOR=2 | |
| MINOR=0 | |
| PATCH=2 | |
| # Get the latest release to find the last build number | |
| LATEST_RELEASE=$(curl -s -H "Authorization: token $GH_TOKEN" \ | |
| "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name // "v0.0.0.0"') | |
| # Extract build number from last release (format: v1.6.5.BUILD) | |
| if [[ $LATEST_RELEASE =~ v[0-9]+\.[0-9]+\.[0-9]+\.([0-9]+) ]]; then | |
| LAST_BUILD=${BASH_REMATCH[1]} | |
| else | |
| LAST_BUILD=0 | |
| fi | |
| # Increment build number | |
| BUILD=$((LAST_BUILD + 1)) | |
| # Handle manual version tags (e.g., v2.0.0.1 for major updates) | |
| if [[ $GITHUB_REF == refs/tags/v* ]]; then | |
| # Use the tag version as-is | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| else | |
| # Auto-increment for regular commits | |
| VERSION="${MAJOR}.${MINOR}.${PATCH}.${BUILD}" | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Building version: $VERSION" | |
| # Store version for later steps | |
| echo "$VERSION" > VERSION.txt | |
| - name: Create source tarball | |
| run: | | |
| VERSION=$(cat VERSION.txt) | |
| DIRNAME="kora-icon-theme-${VERSION}" | |
| mkdir -p "$DIRNAME" | |
| # Copy only the main icon directories | |
| if [ -d "kora" ]; then | |
| cp -r kora "$DIRNAME/" | |
| fi | |
| # Additional icon directories if they exist | |
| for dir in kora-light kora-light-panel kora-pgrey; do | |
| if [ -d "$dir" ]; then | |
| cp -r "$dir" "$DIRNAME/" | |
| fi | |
| done | |
| # Copy MIME types | |
| if [ -d "mime" ]; then | |
| cp -r mime "$DIRNAME/" | |
| fi | |
| # Create VERSION file in the package | |
| echo "$VERSION" > "$DIRNAME/VERSION" | |
| tar czf ~/rpmbuild/SOURCES/"${DIRNAME}.tar.gz" "$DIRNAME" | |
| - name: Generate dynamic spec file | |
| run: | | |
| VERSION=$(cat VERSION.txt) | |
| # Replace version placeholder in spec file | |
| sed "s/__VERSION__/${VERSION}/g" kora-icon-theme.spec > ~/rpmbuild/SPECS/kora-icon-theme.spec | |
| - name: Build RPM | |
| run: | | |
| VERSION=$(cat VERSION.txt) | |
| echo "=== Building RPM version ${VERSION} ===" | |
| cd ~/rpmbuild/SPECS | |
| rpmbuild -bb kora-icon-theme.spec \ | |
| --define "version ${VERSION}" \ | |
| --define "_topdir $HOME/rpmbuild" \ | |
| --define "_sourcedir $HOME/rpmbuild/SOURCES" | |
| mkdir -p ~/RPMs | |
| find ~/ -iname "*.rpm" -exec mv {} ~/RPMs \; | |
| [ -e ~/RPMs/*.rpm ] && echo "success" | |
| - name: Upload RPM | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: kora-icon-theme-${{ steps.version.outputs.VERSION }}.rpm | |
| path: ~/RPMs/*.rpm | |
| if-no-files-found: ignore | |
| - name: Download RPM artifact | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: kora-icon-theme-${{ steps.version.outputs.VERSION }}.rpm | |
| path: ./rpm-release | |
| - name: Create Release | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.VERSION }} | |
| name: Release v${{ steps.version.outputs.VERSION }} | |
| body: | | |
| ## Kora Icon Theme v${{ steps.version.outputs.VERSION }} | |
| ### Automated Build | |
| - **Build Date**: ${{ github.event.head_commit.timestamp }} | |
| - **Commit**: ${{ github.sha }} | |
| - **Commit Message**: ${{ github.event.head_commit.message }} | |
| ### Changes | |
| View [recent commits](https://github.com/${{ github.repository }}/commits/main) for details. | |
| files: | | |
| ./rpm-release/*.rpm | |
| allowUpdates: true | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |