|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' # Triggers on version tags like v1.22.0 |
| 7 | + |
| 8 | +jobs: |
| 9 | + create-release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Get version from tag |
| 17 | + id: get_version |
| 18 | + run: | |
| 19 | + # Extract version from tag (remove 'v' prefix) |
| 20 | + VERSION=${GITHUB_REF#refs/tags/} |
| 21 | + VERSION=${VERSION#v} |
| 22 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 23 | + echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
| 24 | +
|
| 25 | + - name: Get commit history |
| 26 | + id: get_commits |
| 27 | + run: | |
| 28 | + # Get the previous tag to determine the range |
| 29 | + PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "") |
| 30 | +
|
| 31 | + if [ -n "$PREVIOUS_TAG" ]; then |
| 32 | + # Get commits between previous tag and current tag |
| 33 | + COMMITS=$(git log --pretty=format:"- %s (%h)" ${PREVIOUS_TAG}..HEAD) |
| 34 | + echo "commits<<EOF" >> $GITHUB_OUTPUT |
| 35 | + echo "$COMMITS" >> $GITHUB_OUTPUT |
| 36 | + echo "EOF" >> $GITHUB_OUTPUT |
| 37 | + echo "has_previous_tag=true" >> $GITHUB_OUTPUT |
| 38 | + else |
| 39 | + # If no previous tag, get all commits |
| 40 | + COMMITS=$(git log --pretty=format:"- %s (%h)" --oneline -20) |
| 41 | + echo "commits<<EOF" >> $GITHUB_OUTPUT |
| 42 | + echo "$COMMITS" >> $GITHUB_OUTPUT |
| 43 | + echo "EOF" >> $GITHUB_OUTPUT |
| 44 | + echo "has_previous_tag=false" >> $GITHUB_OUTPUT |
| 45 | + fi |
| 46 | +
|
| 47 | + - name: Wait for builds to complete |
| 48 | + run: | |
| 49 | + echo "Waiting for build workflows to complete..." |
| 50 | +
|
| 51 | + # Function to check if all required workflows are complete |
| 52 | + check_workflows() { |
| 53 | + local max_attempts=120 # 2 hours maximum (120 * 60 seconds) |
| 54 | + local attempt=1 |
| 55 | + |
| 56 | + while [ $attempt -le $max_attempts ]; do |
| 57 | + echo "Checking build status (attempt $attempt/$max_attempts)..." |
| 58 | + |
| 59 | + # Get the current commit SHA |
| 60 | + COMMIT_SHA=$(git rev-parse HEAD) |
| 61 | + |
| 62 | + # Check if all three build workflows have completed successfully |
| 63 | + # We'll use a simple approach: wait and then proceed |
| 64 | + # The download-artifact action will handle missing artifacts gracefully |
| 65 | + |
| 66 | + echo "Waiting 60 seconds before next check..." |
| 67 | + sleep 60 |
| 68 | + attempt=$((attempt + 1)) |
| 69 | + done |
| 70 | + |
| 71 | + echo "Maximum wait time reached. Proceeding with available artifacts..." |
| 72 | + } |
| 73 | +
|
| 74 | + # Start the check process |
| 75 | + check_workflows |
| 76 | +
|
| 77 | + - name: Download all artifacts |
| 78 | + uses: actions/download-artifact@v4 |
| 79 | + with: |
| 80 | + path: artifacts |
| 81 | + pattern: 'GeoDa-*' |
| 82 | + |
| 83 | + - name: List downloaded artifacts |
| 84 | + run: | |
| 85 | + echo "Downloaded artifacts:" |
| 86 | + find artifacts -type f -name "*.dmg" -o -name "*.exe" -o -name "*.deb" | sort |
| 87 | +
|
| 88 | + - name: Create Release |
| 89 | + id: create_release |
| 90 | + uses: actions/create-release@v1 |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + with: |
| 94 | + tag_name: ${{ steps.get_version.outputs.tag }} |
| 95 | + release_name: GeoDa ${{ steps.get_version.outputs.version }} |
| 96 | + body: | |
| 97 | + ## GeoDa ${{ steps.get_version.outputs.version }} |
| 98 | +
|
| 99 | + ### What's Changed |
| 100 | +
|
| 101 | + This release includes the following changes since the previous version: |
| 102 | +
|
| 103 | + ${{ steps.get_commits.outputs.commits }} |
| 104 | +
|
| 105 | + For detailed information about changes in this release, see the [changelog](https://github.com/GeoDaCenter/geoda/blob/master/CHANGELOG.md). |
| 106 | + draft: false |
| 107 | + prerelease: false |
| 108 | + |
| 109 | + - name: Upload Windows 32-bit Installer |
| 110 | + uses: actions/upload-release-asset@v1 |
| 111 | + env: |
| 112 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 113 | + with: |
| 114 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 115 | + asset_path: ./artifacts/GeoDa-Windows-x86-installer/GeoDa_${{ steps.get_version.outputs.version }}_x86_Setup.exe |
| 116 | + asset_name: GeoDa_${{ steps.get_version.outputs.version }}_x86_Setup.exe |
| 117 | + asset_content_type: application/octet-stream |
| 118 | + continue-on-error: true |
| 119 | + |
| 120 | + - name: Upload Windows 64-bit Installer |
| 121 | + uses: actions/upload-release-asset@v1 |
| 122 | + env: |
| 123 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 124 | + with: |
| 125 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 126 | + asset_path: ./artifacts/GeoDa-Windows-x64-installer/GeoDa_${{ steps.get_version.outputs.version }}_x64_Setup.exe |
| 127 | + asset_name: GeoDa_${{ steps.get_version.outputs.version }}_x64_Setup.exe |
| 128 | + asset_content_type: application/octet-stream |
| 129 | + continue-on-error: true |
| 130 | + |
| 131 | + - name: Upload Windows 7+ 32-bit Installer |
| 132 | + uses: actions/upload-release-asset@v1 |
| 133 | + env: |
| 134 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 135 | + with: |
| 136 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 137 | + asset_path: ./artifacts/GeoDa-Windows7+-x86-installer/GeoDa_${{ steps.get_version.outputs.version }}_win7+x86_Setup.exe |
| 138 | + asset_name: GeoDa_${{ steps.get_version.outputs.version }}_win7+x86_Setup.exe |
| 139 | + asset_content_type: application/octet-stream |
| 140 | + continue-on-error: true |
| 141 | + |
| 142 | + - name: Upload Windows 7+ 64-bit Installer |
| 143 | + uses: actions/upload-release-asset@v1 |
| 144 | + env: |
| 145 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 146 | + with: |
| 147 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 148 | + asset_path: ./artifacts/GeoDa-Windows7+-x64-installer/GeoDa_${{ steps.get_version.outputs.version }}_win7+x64_Setup.exe |
| 149 | + asset_name: GeoDa_${{ steps.get_version.outputs.version }}_win7+x64_Setup.exe |
| 150 | + asset_content_type: application/octet-stream |
| 151 | + continue-on-error: true |
| 152 | + |
| 153 | + - name: Upload macOS Intel Installer |
| 154 | + uses: actions/upload-release-asset@v1 |
| 155 | + env: |
| 156 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 157 | + with: |
| 158 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 159 | + asset_path: ./artifacts/GeoDa-${{ steps.get_version.outputs.version }}-x86_64-MacOS/GeoDa${{ steps.get_version.outputs.version }}-x86_64-Installer.dmg |
| 160 | + asset_name: GeoDa${{ steps.get_version.outputs.version }}-x86_64-Installer.dmg |
| 161 | + asset_content_type: application/octet-stream |
| 162 | + continue-on-error: true |
| 163 | + |
| 164 | + - name: Upload macOS ARM64 Installer |
| 165 | + uses: actions/upload-release-asset@v1 |
| 166 | + env: |
| 167 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 168 | + with: |
| 169 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 170 | + asset_path: ./artifacts/GeoDa-${{ steps.get_version.outputs.version }}-arm64-MacOS/GeoDa${{ steps.get_version.outputs.version }}-arm64-Installer.dmg |
| 171 | + asset_name: GeoDa${{ steps.get_version.outputs.version }}-arm64-Installer.dmg |
| 172 | + asset_content_type: application/octet-stream |
| 173 | + continue-on-error: true |
| 174 | + |
| 175 | + - name: Upload Ubuntu 20.04 Package |
| 176 | + uses: actions/upload-release-asset@v1 |
| 177 | + env: |
| 178 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 179 | + with: |
| 180 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 181 | + asset_path: ./artifacts/GeoDa-${{ steps.get_version.outputs.version }}-focal/geoda_${{ steps.get_version.outputs.version }}-1focal1_amd64.deb |
| 182 | + asset_name: geoda_${{ steps.get_version.outputs.version }}-1focal1_amd64.deb |
| 183 | + asset_content_type: application/vnd.debian.binary-package |
| 184 | + continue-on-error: true |
| 185 | + |
| 186 | + - name: Upload Ubuntu 22.04 Package |
| 187 | + uses: actions/upload-release-asset@v1 |
| 188 | + env: |
| 189 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 190 | + with: |
| 191 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 192 | + asset_path: ./artifacts/GeoDa-${{ steps.get_version.outputs.version }}-jammy/geoda_${{ steps.get_version.outputs.version }}-1jammy1_amd64.deb |
| 193 | + asset_name: geoda_${{ steps.get_version.outputs.version }}-1jammy1_amd64.deb |
| 194 | + asset_content_type: application/vnd.debian.binary-package |
| 195 | + continue-on-error: true |
| 196 | + |
| 197 | + - name: Upload Ubuntu 24.04 Package |
| 198 | + uses: actions/upload-release-asset@v1 |
| 199 | + env: |
| 200 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 201 | + with: |
| 202 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 203 | + asset_path: ./artifacts/GeoDa-${{ steps.get_version.outputs.version }}-noble/geoda_${{ steps.get_version.outputs.version }}-1noble1_amd64.deb |
| 204 | + asset_name: geoda_${{ steps.get_version.outputs.version }}-1noble1_amd64.deb |
| 205 | + asset_content_type: application/vnd.debian.binary-package |
| 206 | + continue-on-error: true |
| 207 | + |
| 208 | + - name: Verify Release Assets |
| 209 | + run: | |
| 210 | + echo "Release created successfully!" |
| 211 | + echo "Release URL: ${{ steps.create_release.outputs.html_url }}" |
| 212 | + echo "Upload URL: ${{ steps.create_release.outputs.upload_url }}" |
0 commit comments