|
| 1 | +name: Update AdGuard Home |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + schedule: |
| 5 | + - cron: "0 17 * * *" |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + paths-ignore: |
| 10 | + - "README.md" |
| 11 | + - ".github/workflows/delete-old-workflows.yml" |
| 12 | + - ".github/workflows/update-clashdashboard.yml" |
| 13 | + - ".github/workflows/update-mihomo.yml" |
| 14 | + - ".github/workflows/update-singbox.yml" |
| 15 | + |
| 16 | +jobs: |
| 17 | + go: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + outputs: |
| 20 | + version: ${{ steps.go.outputs.version }} |
| 21 | + steps: |
| 22 | + - name: Get `Go` latest version |
| 23 | + id: go |
| 24 | + run: | |
| 25 | + echo version=$(curl -sSL https://raw.githubusercontent.com/actions/go-versions/update-versions-manifest-file/versions-manifest.json | grep '"version"' | head -1 | awk -F'"' '{print $4}') >> $GITHUB_OUTPUT |
| 26 | +
|
| 27 | + node: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + outputs: |
| 30 | + version: ${{ steps.node.outputs.version }} |
| 31 | + steps: |
| 32 | + - name: Get `Node` latest version (LTS) |
| 33 | + id: node |
| 34 | + run: | |
| 35 | + echo version=$(curl -sSL https://nodejs.org/dist/index.json | jq -r 'map(select(.lts != false)) | .[0].version') >> $GITHUB_OUTPUT |
| 36 | +
|
| 37 | + release: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + needs: go |
| 40 | + outputs: |
| 41 | + release_version: ${{ steps.release.outputs.release_version }} |
| 42 | + steps: |
| 43 | + - name: Checkout `beta-v0.107` |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + repository: AdguardTeam/AdGuardHome |
| 47 | + ref: beta-v0.107 |
| 48 | + fetch-depth: 0 |
| 49 | + |
| 50 | + - name: Setup `Go` |
| 51 | + uses: actions/setup-go@v5 |
| 52 | + with: |
| 53 | + go-version: ${{ needs.go.outputs.version }} |
| 54 | + |
| 55 | + - name: Get `AdGuard Home Release` version |
| 56 | + id: release |
| 57 | + run: | |
| 58 | + release_version=$(git describe --tags --abbrev=0 HEAD) |
| 59 | + echo release_version=$release_version >> $GITHUB_OUTPUT |
| 60 | +
|
| 61 | + release_cross: |
| 62 | + runs-on: ubuntu-latest |
| 63 | + strategy: |
| 64 | + matrix: |
| 65 | + include: |
| 66 | + # Linux |
| 67 | + - { name: linux_amd64, goos: linux, goarch: amd64, goamd64: v1 } |
| 68 | + - { name: linux_armv5, goos: linux, goarch: arm, goarm: 5 } |
| 69 | + - { name: linux_armv6, goos: linux, goarch: arm, goarm: 6 } |
| 70 | + - { name: linux_armv7, goos: linux, goarch: arm, goarm: 7 } |
| 71 | + - { name: linux_arm64, goos: linux, goarch: arm64 } |
| 72 | + - { name: linux_mips_softfloat, goos: linux, goarch: mips, gomips: softfloat } |
| 73 | + - { name: linux_mipsle_softfloat, goos: linux, goarch: mipsle, gomips: softfloat } |
| 74 | + # Windows |
| 75 | + - { name: windows_amd64, goos: windows, goarch: amd64, goamd64: v1 } |
| 76 | + - { name: windows_arm64, goos: windows, goarch: arm64 } |
| 77 | + |
| 78 | + fail-fast: false |
| 79 | + needs: |
| 80 | + - go |
| 81 | + - node |
| 82 | + - release |
| 83 | + env: |
| 84 | + release_VERSION: ${{ needs.release.outputs.release_version }} |
| 85 | + steps: |
| 86 | + - name: Checkout `beta-v0.107` |
| 87 | + uses: actions/checkout@v4 |
| 88 | + with: |
| 89 | + repository: AdguardTeam/AdGuardHome |
| 90 | + ref: beta-v0.107 |
| 91 | + fetch-depth: 1 |
| 92 | + |
| 93 | + - name: Setup `Go` |
| 94 | + uses: actions/setup-go@v5 |
| 95 | + with: |
| 96 | + go-version: ${{ needs.go.outputs.version }} |
| 97 | + |
| 98 | + - name: Adapt `Go` version |
| 99 | + run: | |
| 100 | + go get go@${{ needs.go.outputs.version }} |
| 101 | + go mod tidy |
| 102 | +
|
| 103 | + - name: Setup `Node` |
| 104 | + uses: actions/setup-node@v4 |
| 105 | + with: |
| 106 | + node-version: ${{ needs.node.outputs.version }} |
| 107 | + |
| 108 | + - name: Setup `Snapcraft` |
| 109 | + run: | |
| 110 | + sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft |
| 111 | +
|
| 112 | + - name: Build `AdGuard Home Release` |
| 113 | + id: build |
| 114 | + run: | |
| 115 | + make SIGN=0 VERBOSE=1 ARCH=${{ matrix.goarch }} OS=${{ matrix.goos }} CHANNEL=release VERSION=${{ env.release_VERSION }} GOTOOLCHAIN=local build-release |
| 116 | +
|
| 117 | + - name: Upload files to workspace |
| 118 | + uses: actions/upload-artifact@v4 |
| 119 | + with: |
| 120 | + name: AdGuardHome_release_${{ matrix.name }} |
| 121 | + path: '**/AdGuardHome/AdGuardHome*' |
| 122 | + compression-level: 9 |
| 123 | + |
| 124 | + beta: |
| 125 | + runs-on: ubuntu-latest |
| 126 | + needs: go |
| 127 | + outputs: |
| 128 | + beta_version: ${{ steps.beta.outputs.beta_version }} |
| 129 | + steps: |
| 130 | + - name: Checkout `beta-v0.108` |
| 131 | + uses: actions/checkout@v4 |
| 132 | + with: |
| 133 | + repository: AdguardTeam/AdGuardHome |
| 134 | + ref: beta-v0.108 |
| 135 | + fetch-depth: 0 |
| 136 | + |
| 137 | + - name: Setup `Go` |
| 138 | + uses: actions/setup-go@v5 |
| 139 | + with: |
| 140 | + go-version: ${{ needs.go.outputs.version }} |
| 141 | + |
| 142 | + - name: Get `AdGuard Home Beta` version |
| 143 | + id: beta |
| 144 | + run: | |
| 145 | + beta_version=$(git describe --tags --abbrev=0 HEAD) |
| 146 | + echo beta_version=$beta_version >> $GITHUB_OUTPUT |
| 147 | +
|
| 148 | + beta_cross: |
| 149 | + runs-on: ubuntu-latest |
| 150 | + strategy: |
| 151 | + matrix: |
| 152 | + include: |
| 153 | + # Linux |
| 154 | + - { name: linux_amd64, goos: linux, goarch: amd64, goamd64: v1 } |
| 155 | + - { name: linux_armv5, goos: linux, goarch: arm, goarm: 5 } |
| 156 | + - { name: linux_armv6, goos: linux, goarch: arm, goarm: 6 } |
| 157 | + - { name: linux_armv7, goos: linux, goarch: arm, goarm: 7 } |
| 158 | + - { name: linux_arm64, goos: linux, goarch: arm64 } |
| 159 | + - { name: linux_mips_softfloat, goos: linux, goarch: mips, gomips: softfloat } |
| 160 | + - { name: linux_mipsle_softfloat, goos: linux, goarch: mipsle, gomips: softfloat } |
| 161 | + # Windows |
| 162 | + - { name: windows_amd64, goos: windows, goarch: amd64, goamd64: v1 } |
| 163 | + - { name: windows_arm64, goos: windows, goarch: arm64 } |
| 164 | + |
| 165 | + fail-fast: false |
| 166 | + needs: |
| 167 | + - go |
| 168 | + - node |
| 169 | + - beta |
| 170 | + env: |
| 171 | + beta_VERSION: ${{ needs.beta.outputs.beta_version }} |
| 172 | + steps: |
| 173 | + - name: Checkout `beta-v0.108` |
| 174 | + uses: actions/checkout@v4 |
| 175 | + with: |
| 176 | + repository: AdguardTeam/AdGuardHome |
| 177 | + ref: beta-v0.108 |
| 178 | + fetch-depth: 1 |
| 179 | + |
| 180 | + - name: Setup `Go` |
| 181 | + uses: actions/setup-go@v5 |
| 182 | + with: |
| 183 | + go-version: ${{ needs.go.outputs.version }} |
| 184 | + |
| 185 | + - name: Adapt `Go` version |
| 186 | + run: | |
| 187 | + go get go@${{ needs.go.outputs.version }} |
| 188 | + go mod tidy |
| 189 | +
|
| 190 | + - name: Setup `Node` |
| 191 | + uses: actions/setup-node@v4 |
| 192 | + with: |
| 193 | + node-version: ${{ needs.node.outputs.version }} |
| 194 | + |
| 195 | + - name: Setup `Snapcraft` |
| 196 | + run: | |
| 197 | + sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft |
| 198 | +
|
| 199 | + - name: Build `AdGuard Home Beta` |
| 200 | + id: build |
| 201 | + run: | |
| 202 | + make SIGN=0 VERBOSE=1 ARCH=${{ matrix.goarch }} OS=${{ matrix.goos }} CHANNEL=beta VERSION=${{ env.beta_VERSION }} GOTOOLCHAIN=local build-release |
| 203 | +
|
| 204 | + - name: Upload files to workspace |
| 205 | + uses: actions/upload-artifact@v4 |
| 206 | + with: |
| 207 | + name: AdGuardHome_beta_${{ matrix.name }} |
| 208 | + path: '**/AdGuardHome/AdGuardHome*' |
| 209 | + compression-level: 9 |
| 210 | + |
| 211 | + push_adguardhome: |
| 212 | + needs: |
| 213 | + - release_cross |
| 214 | + - release |
| 215 | + - beta_cross |
| 216 | + - beta |
| 217 | + runs-on: ubuntu-latest |
| 218 | + env: |
| 219 | + release_VERSION: ${{ needs.release.outputs.release_version }} |
| 220 | + beta_VERSION: ${{ needs.beta.outputs.beta_version }} |
| 221 | + steps: |
| 222 | + - name: Clone Repository |
| 223 | + uses: actions/checkout@main |
| 224 | + |
| 225 | + - name: Download files from workspace |
| 226 | + uses: actions/download-artifact@v4 |
| 227 | + with: |
| 228 | + path: ./tmp-AdGuardHome/ |
| 229 | + |
| 230 | + - name: Batch move and rename `AdGuard Home` files |
| 231 | + run: | |
| 232 | + mkdir -p ./tmp-AdGuardHome/compress/ |
| 233 | + archs=(amd64 armv5 armv6 armv7 arm64 mips_softfloat mipsle_softfloat) |
| 234 | + new_name=(amd64 armv5 armv6 armv7 armv8 mips_softfloat mipsle_softfloat) |
| 235 | + for ((i = 0; i < 7; i++)); do |
| 236 | + mv -f "./tmp-AdGuardHome/AdGuardHome_release_linux_${archs[i]}/dist/AdGuardHome_linux_${archs[i]//v/_}/AdGuardHome/AdGuardHome" "./tmp-AdGuardHome/compress/AdGuardHome_release_linux_${new_name[i]}" |
| 237 | + mv -f "./tmp-AdGuardHome/AdGuardHome_beta_linux_${archs[i]}/dist/AdGuardHome_linux_${archs[i]//v/_}/AdGuardHome/AdGuardHome" "./tmp-AdGuardHome/compress/AdGuardHome_beta_linux_${new_name[i]}" |
| 238 | + done |
| 239 | + chmod +x ./tmp-AdGuardHome/compress/* |
| 240 | +
|
| 241 | + - name: Setup `upx` and compress `AdGuard Home` files |
| 242 | + uses: crazy-max/ghaction-upx@v3 |
| 243 | + with: |
| 244 | + version: latest |
| 245 | + files: ./tmp-AdGuardHome/compress/* |
| 246 | + |
| 247 | + - name: Move `AdGuard Home` files |
| 248 | + run: | |
| 249 | + mkdir -p ./AdGuardHome/ |
| 250 | + mv -f ./tmp-AdGuardHome/compress/* ./AdGuardHome/ |
| 251 | + # `Release` for Windows |
| 252 | + mv -f ./tmp-AdGuardHome/AdGuardHome_release_windows_amd64/dist/AdGuardHome_windows_amd64/AdGuardHome/AdGuardHome.exe ./AdGuardHome/AdGuardHome_release_windows_amd64.exe |
| 253 | + mv -f ./tmp-AdGuardHome/AdGuardHome_release_windows_arm64/dist/AdGuardHome_windows_arm64/AdGuardHome/AdGuardHome.exe ./AdGuardHome/AdGuardHome_release_windows_arm64.exe |
| 254 | +
|
| 255 | + # `Beta` for Windows |
| 256 | + mv -f ./tmp-AdGuardHome/AdGuardHome_beta_windows_amd64/dist/AdGuardHome_windows_amd64/AdGuardHome/AdGuardHome.exe ./AdGuardHome/AdGuardHome_beta_windows_amd64.exe |
| 257 | + mv -f ./tmp-AdGuardHome/AdGuardHome_beta_windows_arm64/dist/AdGuardHome_windows_arm64/AdGuardHome/AdGuardHome.exe ./AdGuardHome/AdGuardHome_beta_windows_arm64.exe |
| 258 | + rm -rf ./tmp* |
| 259 | +
|
| 260 | + - name: Release and upload `AdGuardHome` assets |
| 261 | + uses: svenstaro/upload-release-action@v2 |
| 262 | + with: |
| 263 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 264 | + release_name: AdGuardHome |
| 265 | + tag: AdGuardHome |
| 266 | + overwrite: true |
| 267 | + body: | |
| 268 | + [AdGuardHome](https://github.com/AdguardTeam/AdGuardHome) Release 版和 Beta 版 |
| 269 | + 更新 AdGuard Home Release 版至 ${{ env.release_VERSION }},更新 AdGuard Home Beta 版至 ${{ env.beta_VERSION }} |
| 270 | + file_glob: true |
| 271 | + file: ./AdGuardHome/* |
| 272 | + |
| 273 | + - name: Purge jsDelivr CDN |
| 274 | + run: | |
| 275 | + cd ./AdGuardHome/ || exit 1 |
| 276 | + for file in $(ls); do |
| 277 | + curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@AdGuardHome/${file}" |
| 278 | + done |
0 commit comments