Create Release #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: Create Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Release type' | |
| required: true | |
| type: choice | |
| options: | |
| - auto # Otomatik: mevcut ay için patch artırır | |
| - major # Major: yeni ay versiyonu (YY.MM.0) | |
| - minor # Minor: patch versiyonu artırır | |
| custom_version: | |
| description: 'Custom version (optional, format: vYY.MM.PATCH)' | |
| required: false | |
| type: string | |
| env: | |
| BINARY_NAME: folderhost | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Tüm tag'leri almak için gerekli | |
| - name: Calculate version | |
| id: version | |
| run: | | |
| CURRENT_YEAR=$(date +'%y') | |
| CURRENT_MONTH=$(date +'%m') | |
| CURRENT_MONTH=$((10#$CURRENT_MONTH)) | |
| echo "📅 Current date: Year=$CURRENT_YEAR, Month=$CURRENT_MONTH" | |
| if [[ -n "${{ github.event.inputs.custom_version }}" ]]; then | |
| VERSION="${{ github.event.inputs.custom_version }}" | |
| echo "✏️ Using custom version: $VERSION" | |
| elif [[ "${{ github.event.inputs.release_type }}" == "auto" ]]; then | |
| LATEST_TAG=$(git tag -l "v${CURRENT_YEAR}.${CURRENT_MONTH}.*" --sort=-v:refname | head -n 1) | |
| if [ -z "$LATEST_TAG" ]; then | |
| VERSION="v${CURRENT_YEAR}.${CURRENT_MONTH}.0" | |
| echo "🆕 No existing tags for this month, starting with: $VERSION" | |
| else | |
| LAST_PATCH=$(echo $LATEST_TAG | awk -F. '{print $3}') | |
| NEW_PATCH=$((LAST_PATCH + 1)) | |
| VERSION="v${CURRENT_YEAR}.${CURRENT_MONTH}.${NEW_PATCH}" | |
| echo "⬆️ Incrementing from $LATEST_TAG to $VERSION" | |
| fi | |
| elif [[ "${{ github.event.inputs.release_type }}" == "major" ]]; then | |
| # Mevcut ayda zaten bir release varsa uyar | |
| EXISTING_TAG=$(git tag -l "v${CURRENT_YEAR}.${CURRENT_MONTH}.0") | |
| if [ -n "$EXISTING_TAG" ]; then | |
| echo "⚠️ Warning: v${CURRENT_YEAR}.${CURRENT_MONTH}.0 already exists!" | |
| fi | |
| VERSION="v${CURRENT_YEAR}.${CURRENT_MONTH}.0" | |
| echo "🎯 Creating new major version: $VERSION" | |
| elif [[ "${{ github.event.inputs.release_type }}" == "minor" ]]; then | |
| LATEST_TAG=$(git tag -l "v${CURRENT_YEAR}.${CURRENT_MONTH}.*" --sort=-v:refname | head -n 1) | |
| if [ -z "$LATEST_TAG" ]; then | |
| VERSION="v${CURRENT_YEAR}.${CURRENT_MONTH}.0" | |
| echo "🆕 No existing tags for this month, starting with: $VERSION" | |
| else | |
| LAST_PATCH=$(echo $LATEST_TAG | awk -F. '{print $3}') | |
| NEW_PATCH=$((LAST_PATCH + 1)) | |
| VERSION="v${CURRENT_YEAR}.${CURRENT_MONTH}.${NEW_PATCH}" | |
| echo "⬆️ Incrementing from $LATEST_TAG to $VERSION" | |
| fi | |
| fi | |
| if git rev-parse "$VERSION" >/dev/null 2>&1; then | |
| echo "❌ Error: Tag $VERSION already exists!" | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "✅ Final version: $VERSION" | |
| - name: Get current date | |
| id: date | |
| run: echo "current_date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Mingw for Windows cross-compilation | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-mingw-w64 | |
| - name: Install dependencies | |
| run: make setup | |
| - name: Build for Linux and Windows | |
| run: make build | |
| - name: Create release packages | |
| run: | | |
| mkdir -p ./release_packages | |
| # Linux package | |
| cp ./debug/${{ env.BINARY_NAME }} ./${{ env.BINARY_NAME }} | |
| chmod +x ./${{ env.BINARY_NAME }} | |
| zip -j ./release_packages/folderhost-linux-amd64.zip ./${{ env.BINARY_NAME }} | |
| rm ./${{ env.BINARY_NAME }} | |
| echo "✅ Linux package created" | |
| # Windows package | |
| cp ./debug/${{ env.BINARY_NAME }}.exe ./${{ env.BINARY_NAME }}.exe | |
| zip -j ./release_packages/folderhost-windows-amd64.zip ./${{ env.BINARY_NAME }}.exe | |
| rm ./${{ env.BINARY_NAME }}.exe | |
| echo "✅ Windows package created" | |
| - name: Verify packages | |
| run: | | |
| echo "📦 Release packages:" | |
| ls -lh ./release_packages/ | |
| echo "" | |
| echo "📊 Package sizes:" | |
| du -h ./release_packages/* | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.version }} | |
| name: Release ${{ steps.version.outputs.version }} | |
| body: | | |
| 🚀 **Folderhost Release ${{ steps.version.outputs.version }}** | |
| 📅 Release Date: ${{ steps.date.outputs.current_date }} | |
| ## 📦 Downloads | |
| | Platform | Download | Description | | |
| |----------|----------|-------------| | |
| | 🐧 Linux | [`folderhost-linux-amd64.zip`](https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/folderhost-linux-amd64.zip) | Linux x86_64 binary | | |
| | 🪟 Windows | [`folderhost-windows-amd64.zip`](https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/folderhost-windows-amd64.zip) | Windows x86_64 executable | | |
| ## 🔧 Quick Start | |
| ### Linux | |
| ```bash | |
| # Download and extract | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/folderhost-linux-amd64.zip | |
| unzip folderhost-linux-amd64.zip | |
| chmod +x folderhost | |
| # Run | |
| ./folderhost | |
| ``` | |
| ### Windows | |
| ```powershell | |
| # Download, extract, and run | |
| # Edit config.yml as needed | |
| folderhost.exe # Or just double click | |
| ``` | |
| ## ⚙️ Configuration | |
| 1. Extract the downloaded archive | |
| 2. Run the application once to generate `config.yml` | |
| 3. Edit `config.yml` to customize settings | |
| 4. Restart the application | |
| --- | |
| 💡 For issues and questions, please visit the [GitHub Issues](https://github.com/${{ github.repository }}/issues) page. | |
| files: | | |
| ./release_packages/folderhost-linux-amd64.zip | |
| ./release_packages/folderhost-windows-amd64.zip | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Release summary | |
| run: | | |
| echo "🎉 Release ${{ steps.version.outputs.version }} created successfully!" | |
| echo "📍 URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }}" |