├── LICENSE.txt ├── .github └── workflows │ ├── nightly.yml │ ├── adguardhome-ci.yaml │ └── build.yml └── README.md /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2023 Scott Chacon and others 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /.github/workflows/nightly.yml: -------------------------------------------------------------------------------- 1 | name: 'Nightly Builds' 2 | 3 | on: 4 | workflow_dispatch: 5 | # schedule: 6 | # - cron: '0 10 * * *' 7 | # - cron: '0 20 * * *' 8 | 9 | jobs: 10 | check-for-updates: 11 | name: 'Check for AdGuardHome Updates' 12 | runs-on: ubuntu-latest 13 | outputs: 14 | updateAvailable: ${{ env.build_needed }} 15 | steps: 16 | - name: 'Check AdGuard Home Repository for Updates' 17 | run: | 18 | build_needed=0; 19 | adguard_latest=$( git ls-remote --tags --refs --sort="v:refname" https://github.com/AdguardTeam/AdGuardHome.git | awk -F/ 'END{print$NF}' ) 20 | adwire_latest=$( curl -sL https://api.github.com/repos/iganeshk/adwireguard-dark/releases/latest | jq -r ".name" ) 21 | echo "AdGuardHome=${adguard_latest} vs AdWireGuard=${adwire_latest//-dark}" 22 | if [ "$adwire_latest" == "null" ] 23 | then 24 | build_needed=1 25 | else 26 | curl -o ./semver2.sh -fsSL https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/assets/semver2.sh 27 | build_needed=$(bash ./semver2.sh ${adguard_latest} ${adwire_latest//-dark}) 28 | fi 29 | if [ "$build_needed" == 1 ] 30 | then 31 | echo "New AdGuardHome - ${adguard_latest} build anticipated!" 32 | else 33 | echo "AdGuardHome - ${adwire_latest//-dark} is already latest!" 34 | fi 35 | echo "build_needed=${build_needed}" >> $GITHUB_ENV 36 | 37 | build-adguardhome: 38 | name: 'Build AdGuardHome Nightly' 39 | needs: [check-for-updates] 40 | if: ${{ needs.check-for-updates.outputs.updateAvailable == '1' }} 41 | uses: ./.github/workflows/build.yml 42 | secrets: inherit 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AdWireGuard 2 | 3 | [![Build AdguardHome Dark](https://github.com/iganeshk/adwireguard-dark/actions/workflows/build.yml/badge.svg)](https://github.com/iganeshk/adwireguard-dark/actions/workflows/build.yml) 4 | [![Build AdguardHome Dark](https://github.com/iganeshk/adwireguard-dark/actions/workflows/nightly.yml/badge.svg)](https://github.com/iganeshk/adwireguard-dark/actions/workflows/nightly.yml) 5 | [![Build & Docker Workflow](https://img.shields.io/github/v/release/iganeshk/adwireguard-dark.svg?include_prereleases)](https://github.com/iganeshk/adwireguard-dark/releases) 6 | 7 |

8 | AdWireGuard Screenshot 9 |

10 | 11 | ## What? 12 | Docker container housing both [AdGuard Home](https://github.com/AdguardTeam/AdGuardHome/) and [wg-easy](https://github.com/WeeJeWel/wg-easy) (WireGuard Easy) togther to provide the flexibility of running them at once. 13 | 14 | ***Note**: On Android, make sure PrivateDNS is disabled to avoid DNS leaking* 15 | 16 | ## What else? 17 | Bleeding edge distributions for wg-easy patched with security/depenedency updates and adguard home with ~~custom dark theme~~ (temporarily disabled) 18 | 19 | ### **AdWireGuard** 20 | - 🐳 **Docker: [ghcr.io](https://github.com/iganeshk/adwireguard-dark/pkgs/container/adwireguard-dark) | [DockerHub](https://hub.docker.com/r/iganesh/adwireguard-dark)** 21 | 22 | ### **AdGuardHome (Dark)** 23 | - ~~🐳 Docker: [ghcr.io](https://github.com/iganeshk/adwireguard-dark/pkgs/container/adguardhome-dark) | [DockerHub](https://hub.docker.com/r/iganesh/adguardhome-dark)~~ 24 | - ~~⬇️ [Releases](https://github.com/iganeshk/adwireguard-dark/releases)~~ 25 | 26 | ### **wg-easy** 27 | - TBA 28 | 29 | ### Docker-Compose AdWireGuard: 30 | ```yaml 31 | version: "3.8" 32 | 33 | services: 34 | adwireguard: 35 | container_name: adwireguard 36 | # image: ghcr.io/iganeshk/adwireguard-dark:latest 37 | image: iganesh/adwireguard-dark:latest 38 | restart: unless-stopped 39 | ports: 40 | - '53:53' # AdGuardHome DNS Port 41 | - '3000:3000' # Default Address AdGuardHome WebUI 42 | - '853:853' # DNS-TLS 43 | - '51820:51820/udp' # wiregaurd port 44 | - '51821:51821/tcp' # wg-easy webUI 45 | environment: 46 | # WG-EASY ENVS 47 | - WG_HOST= ** HOST-IP ** 48 | - PASSWORD=changeIt 49 | - WG_PORT=51820 50 | - WG_DEFAULT_ADDRESS=10.10.11.x 51 | - WG_DEFAULT_DNS=10.10.10.2 52 | - WG_MTU=1420 53 | - WEBUI_HOST=0.0.0.0 # Change this to allow binding to other than 0.0.0.0 port 54 | volumes: 55 | # adguard-home volume 56 | - './adguard/work:/opt/adwireguard/work' 57 | - './adguard/conf:/opt/adwireguard/conf' 58 | # wg-easy volume 59 | - './wireguard:/etc/wireguard' 60 | cap_add: 61 | - NET_ADMIN 62 | - SYS_MODULE 63 | sysctls: 64 | - net.ipv4.ip_forward=1 65 | - net.ipv4.conf.all.src_valid_mark=1 66 | - net.ipv6.conf.all.disable_ipv6=1 # Disable IPv6 67 | networks: 68 | vpn_net: 69 | ipv4_address: 10.10.10.2 70 | 71 | networks: 72 | vpn_net: 73 | ipam: 74 | driver: default 75 | config: 76 | - subnet: 10.10.10.0/24 77 | 78 | ``` 79 | 80 | 81 | ### wg-easy Patches 82 | - Update base image to node18 alpine (holding node20 due to docker build issues for armv6/v7 arch) 83 | - Updated NodeJS to v18.18.2, bump node dependencies & add ability to adjust WebUI host/port 84 | - Add [Dark mode](https://github.com/wg-easy/wg-easy/pull/178) 85 | -------------------------------------------------------------------------------- /.github/workflows/adguardhome-ci.yaml: -------------------------------------------------------------------------------- 1 | # yamllint disable rule:truthy rule:line-length rule:document-start rule:comments-indentation 2 | name: 'AdGuardHome-CI' 3 | 4 | env: 5 | PATCH_VERSION: 'patch-1.5.7-2' 6 | GO_VERSION: '1.20.10' 7 | NODE_VERSION: '16' 8 | ADGUARDHOME_BUILD_PATH: './adguardhome' 9 | ADGUARDHOME_DIST_PATH: './adguardhome/dist' 10 | WGEASY_REPO_DIR: 'wg-dark' 11 | WGEASY_BUILD_DIR: 'wg-dark-src' 12 | BUILD_ARTIFACT: 'adguardhome-build' 13 | ADWIREGUARD_CACHE: 'adwireguard-docker-cache' 14 | ADWIRE_IMAGE_REPO: 'adwireguard-dark' 15 | ADGUARD_IMAGE_REPO: 'adguardhome-dark' 16 | 17 | on: 18 | workflow_dispatch: 19 | # push: 20 | # branches: 21 | # - main 22 | pull_request: 23 | workflow_call: 24 | 25 | jobs: 26 | adguardhome-ci: 27 | name: 'AdGuardHome CI' 28 | runs-on: ubuntu-latest 29 | outputs: 30 | release_tag: ${{ env.release_tag }} 31 | release_name: ${{ env.release_name }} 32 | build_date: ${{ env.build_date }} 33 | artifact_name: ${{ env.BUILD_ARTIFACT }}-${{ env.release_name }} 34 | adguard_dist_path: ${{ env.adguard_dist_path }} 35 | 36 | steps: 37 | - name: 'Checkout' 38 | uses: 'actions/checkout@v4.1.1' 39 | with: 40 | fetch-depth: 0 41 | 42 | - name: 'Checkout AdguardHome Official Repository' 43 | uses: 'actions/checkout@v4.1.1' 44 | with: 45 | repository: AdguardTeam/AdGuardHome 46 | ref: master 47 | path: ${{ env.ADGUARDHOME_BUILD_PATH }} 48 | fetch-depth: 0 49 | 50 | - name: 'Generate a Release Tag' 51 | working-directory: ${{ env.ADGUARDHOME_BUILD_PATH }} 52 | id: build-version 53 | run: | 54 | # latest_version=$( git -C "./" describe HEAD | sed 's|\(.*\)-.*|\1|' ) 55 | latest_version=$( git -C "./" describe HEAD --abbrev=0 ) 56 | echo "release_tag=${latest_version}" >> $GITHUB_ENV 57 | echo "release_name=${latest_version}-dark" >> $GITHUB_ENV 58 | echo "build_date=$( date -u +'%Y-%m-%dT%H:%M:%SZ' )" >> $GITHUB_ENV 59 | echo "ci_build_date=$(date -d "$build_date" +"%Y%m%d_%H%M%S")" 60 | echo "adguard_dist_path=${{ env.ADGUARDHOME_DIST_PATH }}/docker" >> $GITHUB_ENV 61 | 62 | # - name: 'Fetch and Apply Dark Theme Patch' 63 | # working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' 64 | # run: | 65 | # curl "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/adguardhome/must-orange-dark.patch" \ 66 | # | git apply --whitespace=nowarn -v 67 | 68 | - name: 'Fetch and Apply Build Scripts Patch' 69 | working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' 70 | run: | 71 | curl "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/adguardhome/build-scripts.patch" \ 72 | | git apply --whitespace=nowarn -v 73 | 74 | - name: 'Set up Go' 75 | uses: 'actions/setup-go@v3' 76 | with: 77 | go-version: '${{ env.GO_VERSION }}' 78 | 79 | - name: 'Set up Node' 80 | uses: 'actions/setup-node@v3' 81 | with: 82 | node-version: '${{ env.NODE_VERSION }}' 83 | 84 | - name: 'Set up Go modules cache' 85 | uses: 'actions/cache@v3.3.2' 86 | with: 87 | path: '~/go/pkg/mod' 88 | key: "${{ runner.os }}-go-${{ hashFiles(format('{0}/go.sum', env.ADGUARDHOME_BUILD_PATH)) }}" 89 | restore-keys: '${{ runner.os }}-go-' 90 | 91 | - name: 'Get npm cache directory' 92 | id: 'npm-cache' 93 | run: | 94 | echo "npm_cache_dir=$(npm config get cache)" >> $GITHUB_ENV 95 | 96 | - name: 'Set up npm cache' 97 | uses: 'actions/cache@v3.3.2' 98 | with: 99 | path: '${{ env.npm_cache_dir }}' 100 | key: "${{ runner.os }}-node-${{ hashFiles(format('{0}/client/package-lock.json', env.ADGUARDHOME_BUILD_PATH)) }}" 101 | restore-keys: '${{ runner.os }}-node-' 102 | 103 | - name: 'Build AdGuardHome' 104 | working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' 105 | run: | 106 | make VERSION=${{ env.release_name }} \ 107 | BUILD_SNAP=0 SIGN=0 VERBOSE=1 OS="linux" ARCH="amd64 arm arm64" SNAP=0 \ 108 | build-release 109 | 110 | - name: Upload AGH artifacts 111 | uses: actions/upload-artifact@v3.1.3 112 | with: 113 | name: ${{ env.release_name }}-${{ env.ci_build_date }} 114 | path: ${{ env.ADGUARDHOME_DIST_PATH }}/**/* 115 | retention-days: 60 116 | 117 | 118 | notify-on-fail: 119 | runs-on: ubuntu-latest 120 | needs: [adguardhome-ci] 121 | if: ${{ failure() }} 122 | steps: 123 | - name: 'Notify over Telegram' 124 | uses: appleboy/telegram-action@master 125 | with: 126 | to: ${{ secrets.TELEGRAM_TO }} 127 | token: ${{ secrets.TELEGRAM_TOKEN }} 128 | message: ${{ github.repository }} (${{ github.workflow }}) is failing! 129 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # yamllint disable rule:truthy rule:line-length rule:document-start rule:comments-indentation 2 | name: 'Build AdguardHome Dark' 3 | 4 | env: 5 | PATCH_VERSION: 'patch-1.5.7-2' 6 | GO_VERSION: '1.20.10' 7 | NODE_VERSION: '16' 8 | ADGUARDHOME_BUILD_PATH: './adguardhome' 9 | ADGUARDHOME_DIST_PATH: './adguardhome/dist' 10 | WGEASY_REPO_DIR: 'wg-dark' 11 | WGEASY_BUILD_DIR: 'wg-dark-src' 12 | BUILD_ARTIFACT: 'adguardhome-build' 13 | ADWIREGUARD_CACHE: 'adwireguard-docker-cache' 14 | ADWIRE_IMAGE_REPO: 'adwireguard-dark' 15 | ADGUARD_IMAGE_REPO: 'adguardhome-dark' 16 | 17 | on: 18 | workflow_dispatch: 19 | # push: 20 | # # branches: 21 | # # # - main 22 | pull_request: 23 | workflow_call: 24 | 25 | jobs: 26 | build-latest: 27 | name: 'Build AdGuardHome Latest' 28 | runs-on: ubuntu-latest 29 | outputs: 30 | release_tag: ${{ env.release_tag }} 31 | release_name: ${{ env.release_name }} 32 | build_date: ${{ env.build_date }} 33 | artifact_name: ${{ env.BUILD_ARTIFACT }}-${{ env.release_name }} 34 | adguard_dist_path: ${{ env.adguard_dist_path }} 35 | 36 | steps: 37 | - name: 'Checkout' 38 | uses: 'actions/checkout@v4.1.1' 39 | with: 40 | fetch-depth: 0 41 | 42 | - name: 'Checkout AdguardHome Official Repository' 43 | uses: 'actions/checkout@v4.1.1' 44 | with: 45 | repository: AdguardTeam/AdGuardHome 46 | ref: master 47 | path: ${{ env.ADGUARDHOME_BUILD_PATH }} 48 | fetch-depth: 0 49 | 50 | - name: 'Generate a Release Tag' 51 | working-directory: ${{ env.ADGUARDHOME_BUILD_PATH }} 52 | id: build-version 53 | run: | 54 | # latest_version=$( git -C "./" describe HEAD | sed 's|\(.*\)-.*|\1|' ) 55 | latest_version=$( git -C "./" describe HEAD --abbrev=0 ) 56 | echo "release_tag=${latest_version}" >> $GITHUB_ENV 57 | echo "release_name=${latest_version}-dark" >> $GITHUB_ENV 58 | echo "build_date=$( date -u +'%Y-%m-%dT%H:%M:%SZ' )" >> $GITHUB_ENV 59 | echo "adguard_dist_path=${{ env.ADGUARDHOME_DIST_PATH }}/docker" >> $GITHUB_ENV 60 | 61 | - name: 'Check AdGuardHome existing build cache' 62 | id: check-build-cache 63 | uses: 'actions/cache@v3.3.2' 64 | with: 65 | path: ${{ env.ADGUARDHOME_DIST_PATH }}/docker 66 | key: ${{ env.BUILD_ARTIFACT }}-${{ env.release_name }} 67 | 68 | - name: 'Existing Build Cache Found? ${{ steps.check-build-cache.outputs.cache-hit }}' 69 | run: | 70 | if [ ${{ steps.check-build-cache.outputs.cache-hit }} ] 71 | then 72 | echo "Skipping build, existing cache found" 73 | else 74 | echo "No build cache found, building latest" 75 | fi 76 | 77 | - name: 'Clear Old AdGuardHome build cache' 78 | if: steps.check-build-cache.outputs.cache-hit != 'true' 79 | uses: 'actions/github-script@v6' 80 | with: 81 | script: | 82 | const caches = await github.rest.actions.getActionsCacheList({ 83 | owner: context.repo.owner, 84 | repo: context.repo.repo, 85 | key: '${{ env.BUILD_ARTIFACT }}', 86 | }) 87 | if (caches.data != null && caches.data.total_count > 0) { 88 | console.log("Found %d ${{ env.BUILD_ARTIFACT }} caches", caches.data.total_count) 89 | for (const cache of caches.data.actions_caches) { 90 | console.log("Deleting cache=%s with cacheId=%d", cache.key, cache.id) 91 | github.rest.actions.deleteActionsCacheById({ 92 | owner: context.repo.owner, 93 | repo: context.repo.repo, 94 | cache_id: cache.id, 95 | }) 96 | } 97 | } else { 98 | console.log("no ${{ env.BUILD_ARTIFACT }} caches cleared") 99 | } 100 | 101 | # - name: 'Fetch and Apply Dark Theme Patch' 102 | # if: steps.check-build-cache.outputs.cache-hit != 'true' 103 | # working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' 104 | # run: | 105 | # curl "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/adguardhome/must-orange-dark.patch" \ 106 | # | git apply --whitespace=nowarn -v 107 | 108 | - name: 'Fetch and Apply Build Scripts Patch' 109 | if: steps.check-build-cache.outputs.cache-hit != 'true' 110 | working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' 111 | run: | 112 | curl "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/adguardhome/build-scripts.patch" \ 113 | | git apply --whitespace=nowarn -v 114 | 115 | - name: 'Set up Go' 116 | if: steps.check-build-cache.outputs.cache-hit != 'true' 117 | uses: 'actions/setup-go@v3' 118 | with: 119 | go-version: '${{ env.GO_VERSION }}' 120 | 121 | - name: 'Set up Node' 122 | if: steps.check-build-cache.outputs.cache-hit != 'true' 123 | uses: 'actions/setup-node@v3' 124 | with: 125 | node-version: '${{ env.NODE_VERSION }}' 126 | 127 | - name: 'Set up Go modules cache' 128 | if: steps.check-build-cache.outputs.cache-hit != 'true' 129 | uses: 'actions/cache@v3.3.2' 130 | with: 131 | path: '~/go/pkg/mod' 132 | key: "${{ runner.os }}-go-${{ hashFiles(format('{0}/go.sum', env.ADGUARDHOME_BUILD_PATH)) }}" 133 | restore-keys: '${{ runner.os }}-go-' 134 | 135 | - name: 'Get npm cache directory' 136 | if: steps.check-build-cache.outputs.cache-hit != 'true' 137 | id: 'npm-cache' 138 | run: | 139 | echo "npm_cache_dir=$(npm config get cache)" >> $GITHUB_ENV 140 | 141 | - name: 'Set up npm cache' 142 | if: steps.check-build-cache.outputs.cache-hit != 'true' 143 | uses: 'actions/cache@v3.3.2' 144 | with: 145 | path: '${{ env.npm_cache_dir }}' 146 | key: "${{ runner.os }}-node-${{ hashFiles(format('{0}/client/package-lock.json', env.ADGUARDHOME_BUILD_PATH)) }}" 147 | restore-keys: '${{ runner.os }}-node-' 148 | 149 | - name: 'Build AdGuardHome Binaries' 150 | if: steps.check-build-cache.outputs.cache-hit != 'true' 151 | working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' 152 | run: | 153 | make VERSION=${{ env.release_name }} \ 154 | BUILD_SNAP=0 SIGN=0 VERBOSE=1 OS="linux" ARCH="amd64 arm arm64" SNAP=0 \ 155 | build-release 156 | 157 | - name: 'Prep distributables directory for docker' 158 | if: steps.check-build-cache.outputs.cache-hit != 'true' 159 | working-directory: '${{ env.ADGUARDHOME_DIST_PATH }}' 160 | run: | 161 | mkdir docker 162 | cp "./AdGuardHome_linux_amd64/AdGuardHome/AdGuardHome" "./docker/AdGuardHome_linux_amd64_" 163 | cp "./AdGuardHome_linux_arm64/AdGuardHome/AdGuardHome" "./docker/AdGuardHome_linux_arm64_" 164 | cp "./AdGuardHome_linux_arm_6/AdGuardHome/AdGuardHome" "./docker/AdGuardHome_linux_arm_v6" 165 | cp "./AdGuardHome_linux_arm_7/AdGuardHome/AdGuardHome" "./docker/AdGuardHome_linux_arm_v7" 166 | 167 | - name: 'Cache AdGuardHome Builds' 168 | if: steps.check-build-cache.outputs.cache-hit != 'true' 169 | uses: 'actions/cache@v3.3.2' 170 | with: 171 | path: ${{ env.ADGUARDHOME_DIST_PATH }}/docker 172 | key: ${{ env.BUILD_ARTIFACT }}-${{ env.release_name }} 173 | restore-keys: ${{ env.BUILD_ARTIFACT }}- 174 | 175 | - name: 'Publish Releases' 176 | if: steps.check-build-cache.outputs.cache-hit != 'true' 177 | uses: 'ncipollo/release-action@v1.13.0' 178 | with: 179 | artifacts: "${{ env.ADGUARDHOME_BUILD_PATH}}/dist/*.tar.gz" 180 | token: ${{ secrets.GITHUB_TOKEN }} 181 | tag: ${{ env.release_tag }} 182 | name: ${{ env.release_name }} 183 | allowUpdates: true 184 | 185 | build-docker-adguardhome: 186 | name: 'Docker Build AdguardHome (Dark)' 187 | needs: [build-latest] 188 | runs-on: ubuntu-latest 189 | steps: 190 | # Login to docker and Github CR so build-docker can push images out 191 | - name: 'Login to DockerHub' 192 | uses: 'docker/login-action@v3' 193 | with: 194 | username: ${{ secrets.DOCKER_USERNAME }} 195 | password: ${{ secrets.DOCKER_PASSWORD }} 196 | 197 | - name: 'Log in to the Github Container registry' 198 | uses: 'docker/login-action@v3' 199 | with: 200 | registry: 'ghcr.io' 201 | username: ${{ github.actor }} 202 | password: ${{ secrets.GITHUB_TOKEN }} 203 | 204 | - name: 'Set up QEMU' 205 | uses: 'docker/setup-qemu-action@v3' 206 | 207 | - name: 'Set up Docker Buildx' 208 | uses: 'docker/setup-buildx-action@v3' 209 | 210 | - name: 'Restore AdGuardHome Builds from cache' 211 | uses: actions/cache@v3.3.2 212 | with: 213 | key: ${{ needs.build-latest.outputs.artifact_name }} 214 | path: ${{ needs.build-latest.outputs.adguard_dist_path }} 215 | 216 | - name: 'Fetch DarkAdGuardHome Dockerfile' 217 | working-directory: ./ 218 | run: | 219 | rm -f ./Dockerfile 220 | curl -o ./Dockerfile "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/DarkAdGuardHome.Dockerfile" 221 | 222 | 223 | - name: 'Build & Publish Docker - AdGuardHome Dark' 224 | uses: docker/build-push-action@v5 225 | with: 226 | context: . 227 | file: ./Dockerfile 228 | push: true 229 | outputs: type=image 230 | platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 231 | build-args: | 232 | DIST_DIR=${{ needs.build-latest.outputs.adguard_dist_path }} 233 | labels: | 234 | maintainer=${{ github.actor }} 235 | org.opencontainers.image.created=${{ needs.build-latest.outputs.build_date }} 236 | org.opencontainers.image.description=AdGuardHome Dark (${{ needs.build-latest.outputs.release_name }}) 237 | org.opencontainers.image.licenses=GPL-3.0 238 | org.opencontainers.image.source=https://github/${{ github.repository }} 239 | org.opencontainers.image.title=AdWireGuard 240 | org.opencontainers.image.url=https://github/${{ github.repository }} 241 | org.opencontainers.image.version=${{ needs.build-latest.outputs.release_name }} 242 | tags: | 243 | ghcr.io/${{ github.repository_owner }}/${{ env.ADGUARD_IMAGE_REPO }}:${{ needs.build-latest.outputs.release_tag }} 244 | ghcr.io/${{ github.repository_owner }}/${{ env.ADGUARD_IMAGE_REPO }}:latest 245 | ${{ secrets.DOCKER_USERNAME }}/${{ env.ADGUARD_IMAGE_REPO }}:${{ needs.build-latest.outputs.release_tag }} 246 | ${{ secrets.DOCKER_USERNAME }}/${{ env.ADGUARD_IMAGE_REPO }}:latest 247 | 248 | - name: 'Delete all containers from package without tags' 249 | uses: Chizkiyahu/delete-untagged-ghcr-action@v3.2.0 250 | with: 251 | token: ${{ secrets.PKG_MGR_TOKEN }} 252 | repository_owner: ${{ github.repository_owner }} 253 | package_name: ${{ env.ADGUARD_IMAGE_REPO }} 254 | untagged_only: true 255 | owner_type: user 256 | 257 | adwireguard-docker-cache: 258 | name: 'Prep AdWireGuard Docker' 259 | needs: [build-latest] 260 | runs-on: ubuntu-latest 261 | outputs: 262 | release_tag: ${{ env.release_tag }} 263 | release_name: ${{ env.release_name }} 264 | build_date: ${{ env.build_date }} 265 | artifact_name: ${{ env.BUILD_ARTIFACT }}-${{ env.release_name }} 266 | adguard_dist_path: ${{ env.adguard_dist_path }} 267 | steps: 268 | - name: 'Reciprocate env vars for dependent jobs' 269 | run: | 270 | echo "release_tag=${{ needs.build-latest.outputs.release_tag }}" >> $GITHUB_ENV 271 | echo "release_name=${{ needs.build-latest.outputs.release_name }}" >> $GITHUB_ENV 272 | echo "build_date=${{ needs.build-latest.outputs.build_date }}" >> $GITHUB_ENV 273 | echo "adguard_dist_path=${{ needs.build-latest.outputs.adguard_dist_path }}" >> $GITHUB_ENV 274 | - name: 'Clear all old AdWireGuard caches' 275 | uses: actions/github-script@v6 276 | with: 277 | script: | 278 | const caches = await github.rest.actions.getActionsCacheList({ 279 | owner: context.repo.owner, 280 | repo: context.repo.repo, 281 | key: '${{ env.ADWIREGUARD_CACHE }}', 282 | }) 283 | if (caches.data != null && caches.data.total_count > 0) { 284 | console.log("Found %d ${{ env.ADWIREGUARD_CACHE }} caches", caches.data.total_count) 285 | for (const cache of caches.data.actions_caches) { 286 | console.log("Deleting cache=%s with cacheId=%d", cache.key, cache.id) 287 | github.rest.actions.deleteActionsCacheById({ 288 | owner: context.repo.owner, 289 | repo: context.repo.repo, 290 | cache_id: cache.id, 291 | }) 292 | } 293 | } else { 294 | console.log("no ${{ env.ADWIREGUARD_CACHE }} caches found to be cleared") 295 | } 296 | 297 | - name: 'Restore AdGuardHome Builds from cache' 298 | uses: actions/cache@v3.3.2 299 | with: 300 | key: ${{ needs.build-latest.outputs.artifact_name }} 301 | path: ${{ needs.build-latest.outputs.adguard_dist_path }} 302 | 303 | - name: 'Checkout wg-easy (official) repo into adguardhome dist directory' 304 | uses: 'actions/checkout@v4.1.1' 305 | with: 306 | repository: WeeJeWel/wg-easy 307 | ref: production 308 | path: '${{ needs.build-latest.outputs.adguard_dist_path }}/${{ env.WGEASY_REPO_DIR }}' 309 | fetch-depth: 0 310 | 311 | - name: 'Apply Patches to wg-easy' 312 | working-directory: '${{ needs.build-latest.outputs.adguard_dist_path }}/${{ env.WGEASY_REPO_DIR }}' 313 | run: | 314 | echo "applying dark-theme patch to wg-easy" 315 | curl "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/wg-easy/dark-theme.patch" | git apply --whitespace=nowarn -v 316 | echo "applying dependency vulnerabilities patch to wg-easy" 317 | curl "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/wg-easy/dependencies.patch" | git apply --whitespace=nowarn -v 318 | 319 | - name: 'Fetch AdWireGuard Dockerfile' 320 | working-directory: ./ 321 | run: | 322 | rm -f ./Dockerfile 323 | curl -o ./Dockerfile "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/AdWireGuard.Dockerfile" 324 | 325 | - name: 'Fetch Entrypoint and Prep for docker' 326 | working-directory: '${{ needs.build-latest.outputs.adguard_dist_path }}' 327 | run: | 328 | # working directory - ./adguardhome/dist/docker 329 | curl -o ./entrypoint.sh "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/entrypoint.sh" 330 | cp -r '${{ env.WGEASY_REPO_DIR }}/src/' './${{ env.WGEASY_BUILD_DIR }}' 331 | 332 | - name: 'Temporarily Cache AdWireGuard' 333 | uses: actions/cache@v3.3.2 334 | with: 335 | path: ./ 336 | key: ${{ env.ADWIREGUARD_CACHE }} 337 | restore-keys: ${{ env.ADWIREGUARD_CACHE }}- 338 | 339 | build-adwireguard-dockerhub: 340 | name: 'DockerHub Build AdWireGuard' 341 | needs: [adwireguard-docker-cache] 342 | runs-on: ubuntu-latest 343 | steps: 344 | - name: 'Login to DockerHub' 345 | uses: 'docker/login-action@v3' 346 | with: 347 | username: ${{ secrets.DOCKER_USERNAME }} 348 | password: ${{ secrets.DOCKER_PASSWORD }} 349 | 350 | - name: 'Set up QEMU' 351 | uses: 'docker/setup-qemu-action@v3' 352 | 353 | - name: 'Set up Docker Buildx' 354 | uses: 'docker/setup-buildx-action@v3' 355 | 356 | - name: 'Restore AdWireGuard Docker cache' 357 | uses: actions/cache@v3.3.2 358 | with: 359 | key: ${{ env.ADWIREGUARD_CACHE }} 360 | path: ./ 361 | 362 | # Build & Publish 363 | - name: 'Build & Publish Dockerhub - AdWireGuard' 364 | uses: docker/build-push-action@v5 365 | with: 366 | context: . 367 | file: ./Dockerfile 368 | push: true 369 | outputs: type=image 370 | platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 371 | build-args: | 372 | DIST_DIR=${{ needs.adwireguard-docker-cache.outputs.adguard_dist_path }} 373 | WG_PATH=${{ env.WGEASY_BUILD_DIR }} 374 | labels: | 375 | maintainer=${{ github.actor }} 376 | org.opencontainers.image.created=${{ needs.adwireguard-docker-cache.outputs.build_date }} 377 | org.opencontainers.image.description=AdWireGuard Dark (AdGuard+WireGuard) (${{ needs.adwireguard-docker-cache.outputs.release_name }}) 378 | org.opencontainers.image.licenses=GPL-3.0 379 | org.opencontainers.image.source=https://github/${{ github.repository }} 380 | org.opencontainers.image.title=AdWireGuard Dark 381 | org.opencontainers.image.url=https://github/${{ github.repository }} 382 | org.opencontainers.image.version=${{ needs.adwireguard-docker-cache.outputs.release_name }} 383 | tags: | 384 | ${{ secrets.DOCKER_USERNAME }}/${{ env.ADWIRE_IMAGE_REPO }}:${{ needs.adwireguard-docker-cache.outputs.release_tag }} 385 | ${{ secrets.DOCKER_USERNAME }}/${{ env.ADWIRE_IMAGE_REPO }}:latest 386 | 387 | # GithubCR workaround for manifest inssue by publishing individual architectures 388 | build-adwireguard-ghcr: 389 | name: 'GithubCR Build (${{ matrix.tag }})' 390 | needs: [adwireguard-docker-cache] 391 | runs-on: ubuntu-latest 392 | strategy: 393 | fail-fast: false 394 | matrix: 395 | include: 396 | - arch: linux/arm/v6 397 | tag: armv6 398 | - arch: linux/arm/v7 399 | tag: armv7 400 | - arch: linux/arm64 401 | tag: arm64 402 | - arch: linux/amd64 403 | tag: amd64 404 | steps: 405 | # Login to Github CR so build-docker can push images out 406 | - name: 'Log in to the Github Container registry' 407 | uses: 'docker/login-action@v3' 408 | with: 409 | registry: 'ghcr.io' 410 | username: ${{ github.actor }} 411 | password: ${{ secrets.GITHUB_TOKEN }} 412 | 413 | - name: 'Set up QEMU' 414 | uses: 'docker/setup-qemu-action@v3' 415 | 416 | - name: 'Set up Docker Buildx' 417 | uses: 'docker/setup-buildx-action@v3' 418 | 419 | - name: 'Restore AdWireGuard Docker cache' 420 | uses: actions/cache@v3.3.2 421 | with: 422 | key: ${{ env.ADWIREGUARD_CACHE }} 423 | path: ./ 424 | 425 | - name: 'GithubCR ${{ matrix.arch }} Publish - AdWireGuard' 426 | uses: docker/build-push-action@v3 427 | with: 428 | context: . 429 | file: ./Dockerfile 430 | push: true 431 | outputs: type=image 432 | platforms: ${{ matrix.arch }} 433 | build-args: | 434 | DIST_DIR=${{ needs.adwireguard-docker-cache.outputs.adguard_dist_path }} 435 | WG_PATH=${{ env.WGEASY_BUILD_DIR }} 436 | labels: | 437 | maintainer=${{ github.actor }} 438 | org.opencontainers.image.created=${{ needs.adwireguard-docker-cache.outputs.build_date }} 439 | org.opencontainers.image.description=AdWireGuard Dark (AdGuard+WireGuard) (${{ needs.adwireguard-docker-cache.outputs.release_name }}) 440 | org.opencontainers.image.licenses=GPL-3.0 441 | org.opencontainers.image.source=https://github/${{ github.repository }} 442 | org.opencontainers.image.title=AdWireGuard Dark 443 | org.opencontainers.image.url=https://github/${{ github.repository }} 444 | org.opencontainers.image.version=${{ needs.adwireguard-docker-cache.outputs.release_name }} 445 | tags: | 446 | ghcr.io/${{ github.repository }}:latest 447 | ghcr.io/${{ github.repository }}:${{ matrix.tag }} 448 | ghcr.io/${{ github.repository }}:${{ matrix.tag }}-${{ needs.adwireguard-docker-cache.outputs.release_tag }} 449 | 450 | cleanup-untagged-containes: 451 | name: 'Cleanup GHCR untagged images' 452 | needs: [build-adwireguard-ghcr] 453 | runs-on: ubuntu-latest 454 | steps: 455 | - name: 'Delete all images without tags' 456 | uses: Chizkiyahu/delete-untagged-ghcr-action@v3.2.0 457 | with: 458 | token: ${{ secrets.PKG_MGR_TOKEN }} 459 | repository_owner: ${{ github.repository_owner }} 460 | repository: ${{ github.repository }} 461 | package_name: ${{ env.ADWIRE_IMAGE_REPO }} 462 | untagged_only: true 463 | owner_type: user 464 | 465 | notify: 466 | runs-on: ubuntu-latest 467 | needs: [build-latest] 468 | # Secrets are not passed to workflows that are triggered by a pull request 469 | # from a fork. 470 | # https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions 471 | # Use always() to signal to the runner that this job must run even if the 472 | # previous ones failed. 473 | # 'if': 474 | # ${{ 475 | # always() && 476 | # github.repository_owner == 'iganeshk' && 477 | # ( 478 | # github.event_name == 'push' || 479 | # github.event.pull_request.head.repo.full_name == github.repository 480 | # ) 481 | # }} 482 | if: ${{ success() }} 483 | steps: 484 | - name: 'Notify over Telegram' 485 | uses: appleboy/telegram-action@master 486 | with: 487 | to: ${{ secrets.TELEGRAM_TO }} 488 | token: ${{ secrets.TELEGRAM_TOKEN }} 489 | message: | 490 | ${{ github.actor }} created commit: 491 | Commit message: ${{ github.event.commits[0].message }} 492 | Repository: ${{ github.repository }} 493 | See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} 494 | 495 | notify-on-fail: 496 | runs-on: ubuntu-latest 497 | needs: [build-latest] 498 | if: ${{ failure() }} 499 | steps: 500 | - name: 'Notify over Telegram' 501 | uses: appleboy/telegram-action@master 502 | with: 503 | to: ${{ secrets.TELEGRAM_TO }} 504 | token: ${{ secrets.TELEGRAM_TOKEN }} 505 | message: ${{ github.repository }} (${{ github.workflow }}) is failing! 506 | --------------------------------------------------------------------------------