|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + |
| 11 | +jobs: |
| 12 | + create-release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Generate changelog |
| 22 | + id: changelog |
| 23 | + run: | |
| 24 | + PREVIOUS_TAG=$(git tag --sort=-creatordate | sed -n '2p') |
| 25 | + |
| 26 | + if [ -z "$PREVIOUS_TAG" ]; then |
| 27 | + CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges) |
| 28 | + else |
| 29 | + CHANGELOG=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges) |
| 30 | + fi |
| 31 | + |
| 32 | + echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT |
| 33 | + echo "$CHANGELOG" >> $GITHUB_OUTPUT |
| 34 | + echo "EOF" >> $GITHUB_OUTPUT |
| 35 | + |
| 36 | + - name: Create Release |
| 37 | + id: create_release |
| 38 | + uses: actions/create-release@v1 |
| 39 | + env: |
| 40 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + with: |
| 42 | + tag_name: ${{ github.ref_name }} |
| 43 | + release_name: Release ${{ github.ref_name }} |
| 44 | + body: | |
| 45 | + ## Changes in this release |
| 46 | +
|
| 47 | + ${{ steps.changelog.outputs.CHANGELOG }} |
| 48 | +
|
| 49 | + ## Downloads |
| 50 | +
|
| 51 | + Choose the correct file for your operating system: |
| 52 | + - **Linux**: `aw-nextblock-linux.zip` |
| 53 | + - **Windows**: `aw-nextblock-windows.zip` |
| 54 | + - **macOS**: `aw-nextblock-macos.zip` |
| 55 | +
|
| 56 | + ## Installation |
| 57 | +
|
| 58 | + 1. Download and extract the ZIP file |
| 59 | + 2. Run `nextblock-ctl --help` or `aw-watcher-nextblock` |
| 60 | + 3. Configure visualization path: `nextblock-ctl visualization-path` |
| 61 | + draft: false |
| 62 | + prerelease: false |
| 63 | + |
| 64 | + build-linux: |
| 65 | + needs: create-release |
| 66 | + runs-on: ubuntu-22.04 |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v3 |
| 69 | + |
| 70 | + - name: Set up Python |
| 71 | + uses: actions/setup-python@v4 |
| 72 | + with: |
| 73 | + python-version: '3.13' |
| 74 | + |
| 75 | + - name: Install Poetry |
| 76 | + run: pip install poetry==2.2.1 |
| 77 | + |
| 78 | + - name: Install dependencies |
| 79 | + run: | |
| 80 | + poetry config virtualenvs.create false |
| 81 | + poetry install |
| 82 | +
|
| 83 | + - name: Install PyInstaller |
| 84 | + run: pip install pyinstaller |
| 85 | + |
| 86 | + - name: Build with PyInstaller |
| 87 | + run: pyinstaller --clean pyinstaller.spec |
| 88 | + |
| 89 | + - name: Create ZIP with visualization |
| 90 | + run: | |
| 91 | + cd dist |
| 92 | + zip -r ../aw-nextblock-linux.zip aw-nextblock/ |
| 93 | + cd .. |
| 94 | + zip -r aw-nextblock-linux.zip visualization/ |
| 95 | +
|
| 96 | + - name: Upload Release Asset |
| 97 | + uses: actions/upload-release-asset@v1 |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + with: |
| 101 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 102 | + asset_path: ./aw-nextblock-linux.zip |
| 103 | + asset_name: aw-nextblock-linux.zip |
| 104 | + asset_content_type: application/zip |
| 105 | + |
| 106 | + build-windows: |
| 107 | + needs: create-release |
| 108 | + runs-on: windows-latest |
| 109 | + steps: |
| 110 | + - uses: actions/checkout@v3 |
| 111 | + |
| 112 | + - name: Set up Python |
| 113 | + uses: actions/setup-python@v4 |
| 114 | + with: |
| 115 | + python-version: '3.13' |
| 116 | + |
| 117 | + - name: Install Poetry |
| 118 | + run: pip install poetry==2.2.1 |
| 119 | + |
| 120 | + - name: Install dependencies |
| 121 | + run: | |
| 122 | + poetry config virtualenvs.create false |
| 123 | + poetry install |
| 124 | +
|
| 125 | + - name: Install PyInstaller |
| 126 | + run: pip install pyinstaller |
| 127 | + |
| 128 | + - name: Build with PyInstaller |
| 129 | + run: pyinstaller --clean pyinstaller.spec |
| 130 | + |
| 131 | + - name: Create ZIP with visualization |
| 132 | + shell: powershell |
| 133 | + run: | |
| 134 | + Compress-Archive -Path dist/aw-nextblock/* -DestinationPath aw-nextblock-windows.zip |
| 135 | + Expand-Archive -Path aw-nextblock-windows.zip -DestinationPath temp |
| 136 | + Copy-Item -Path visualization -Destination temp/visualization -Recurse |
| 137 | + Remove-Item aw-nextblock-windows.zip |
| 138 | + Compress-Archive -Path temp/* -DestinationPath aw-nextblock-windows.zip |
| 139 | +
|
| 140 | + - name: Upload Release Asset |
| 141 | + uses: actions/upload-release-asset@v1 |
| 142 | + env: |
| 143 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 144 | + with: |
| 145 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 146 | + asset_path: ./aw-nextblock-windows.zip |
| 147 | + asset_name: aw-nextblock-windows.zip |
| 148 | + asset_content_type: application/zip |
| 149 | + |
| 150 | + build-macos: |
| 151 | + needs: create-release |
| 152 | + runs-on: macos-latest |
| 153 | + steps: |
| 154 | + - uses: actions/checkout@v3 |
| 155 | + |
| 156 | + - name: Set up Python |
| 157 | + run: | |
| 158 | + curl https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg -o "python.pkg" |
| 159 | + sudo installer -pkg python.pkg -target / |
| 160 | + echo "/Library/Frameworks/Python.framework/Versions/3.13/bin" >> $GITHUB_PATH |
| 161 | +
|
| 162 | + - name: Install Poetry |
| 163 | + run: pip3 install poetry==2.2.1 |
| 164 | + |
| 165 | + - name: Install dependencies |
| 166 | + run: | |
| 167 | + poetry config virtualenvs.create false |
| 168 | + poetry install |
| 169 | +
|
| 170 | + - name: Install PyInstaller |
| 171 | + run: pip3 install pyinstaller |
| 172 | + |
| 173 | + - name: Build with PyInstaller |
| 174 | + run: pyinstaller --clean pyinstaller.spec |
| 175 | + |
| 176 | + - name: Create ZIP with visualization |
| 177 | + run: | |
| 178 | + cd dist |
| 179 | + zip -r ../aw-nextblock-macos.zip aw-nextblock/ |
| 180 | + cd .. |
| 181 | + zip -r aw-nextblock-macos.zip visualization/ |
| 182 | +
|
| 183 | + - name: Upload Release Asset |
| 184 | + uses: actions/upload-release-asset@v1 |
| 185 | + env: |
| 186 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 187 | + with: |
| 188 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 189 | + asset_path: ./aw-nextblock-macos.zip |
| 190 | + asset_name: aw-nextblock-macos.zip |
| 191 | + asset_content_type: application/zip |
0 commit comments