AdGuardHome-CI #2
This file contains 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
# yamllint disable rule:truthy rule:line-length rule:document-start rule:comments-indentation | |
name: 'AdGuardHome-CI' | |
env: | |
PATCH_VERSION: 'patch-1.5.7-2' | |
GO_VERSION: '1.20.10' | |
NODE_VERSION: '16' | |
ADGUARDHOME_BUILD_PATH: './adguardhome' | |
ADGUARDHOME_DIST_PATH: './adguardhome/dist' | |
WGEASY_REPO_DIR: 'wg-dark' | |
WGEASY_BUILD_DIR: 'wg-dark-src' | |
BUILD_ARTIFACT: 'adguardhome-build' | |
ADWIREGUARD_CACHE: 'adwireguard-docker-cache' | |
ADWIRE_IMAGE_REPO: 'adwireguard-dark' | |
ADGUARD_IMAGE_REPO: 'adguardhome-dark' | |
on: | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - main | |
pull_request: | |
workflow_call: | |
jobs: | |
adguardhome-ci: | |
name: 'AdGuardHome CI' | |
runs-on: ubuntu-latest | |
outputs: | |
release_tag: ${{ env.release_tag }} | |
release_name: ${{ env.release_name }} | |
build_date: ${{ env.build_date }} | |
artifact_name: ${{ env.BUILD_ARTIFACT }}-${{ env.release_name }} | |
adguard_dist_path: ${{ env.adguard_dist_path }} | |
steps: | |
- name: 'Checkout' | |
uses: 'actions/[email protected]' | |
with: | |
fetch-depth: 0 | |
- name: 'Checkout AdguardHome Official Repository' | |
uses: 'actions/[email protected]' | |
with: | |
repository: AdguardTeam/AdGuardHome | |
ref: master | |
path: ${{ env.ADGUARDHOME_BUILD_PATH }} | |
fetch-depth: 0 | |
- name: 'Generate a Release Tag' | |
working-directory: ${{ env.ADGUARDHOME_BUILD_PATH }} | |
id: build-version | |
run: | | |
# latest_version=$( git -C "./" describe HEAD | sed 's|\(.*\)-.*|\1|' ) | |
latest_version=$( git -C "./" describe HEAD --abbrev=0 ) | |
echo "release_tag=${latest_version}" >> $GITHUB_ENV | |
echo "release_name=${latest_version}-dark" >> $GITHUB_ENV | |
echo "build_date=$( date -u +'%Y-%m-%dT%H:%M:%SZ' )" >> $GITHUB_ENV | |
echo "ci_build_date=$(date -d "$build_date" +"%Y%m%d_%H%M%S")" | |
echo "adguard_dist_path=${{ env.ADGUARDHOME_DIST_PATH }}/docker" >> $GITHUB_ENV | |
# - name: 'Fetch and Apply Dark Theme Patch' | |
# working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' | |
# run: | | |
# curl "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/adguardhome/must-orange-dark.patch" \ | |
# | git apply --whitespace=nowarn -v | |
- name: 'Fetch and Apply Build Scripts Patch' | |
working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' | |
run: | | |
curl "https://raw.githubusercontent.com/iganeshk/AdWireGuard-Dark/${{ env.PATCH_VERSION }}/adguardhome/build-scripts.patch" \ | |
| git apply --whitespace=nowarn -v | |
- name: 'Set up Go' | |
uses: 'actions/setup-go@v3' | |
with: | |
go-version: '${{ env.GO_VERSION }}' | |
- name: 'Set up Node' | |
uses: 'actions/setup-node@v3' | |
with: | |
node-version: '${{ env.NODE_VERSION }}' | |
- name: 'Set up Go modules cache' | |
uses: 'actions/[email protected]' | |
with: | |
path: '~/go/pkg/mod' | |
key: "${{ runner.os }}-go-${{ hashFiles(format('{0}/go.sum', env.ADGUARDHOME_BUILD_PATH)) }}" | |
restore-keys: '${{ runner.os }}-go-' | |
- name: 'Get npm cache directory' | |
id: 'npm-cache' | |
run: | | |
echo "npm_cache_dir=$(npm config get cache)" >> $GITHUB_ENV | |
- name: 'Set up npm cache' | |
uses: 'actions/[email protected]' | |
with: | |
path: '${{ env.npm_cache_dir }}' | |
key: "${{ runner.os }}-node-${{ hashFiles(format('{0}/client/package-lock.json', env.ADGUARDHOME_BUILD_PATH)) }}" | |
restore-keys: '${{ runner.os }}-node-' | |
- name: 'Build AdGuardHome' | |
working-directory: '${{ env.ADGUARDHOME_BUILD_PATH }}' | |
run: | | |
make VERSION=${{ env.release_name }} \ | |
BUILD_SNAP=0 SIGN=0 VERBOSE=1 OS="linux" ARCH="amd64 arm arm64" SNAP=0 \ | |
build-release | |
- name: Upload AGH artifacts | |
uses: actions/[email protected] | |
with: | |
name: ${{ env.release_name }}-${{ env.ci_build_date }} | |
path: ${{ env.ADGUARDHOME_DIST_PATH }}/**/* | |
retention-days: 60 | |
notify-on-fail: | |
runs-on: ubuntu-latest | |
needs: [adguardhome-ci] | |
if: ${{ failure() }} | |
steps: | |
- name: 'Notify over Telegram' | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: ${{ github.repository }} (${{ github.workflow }}) is failing! |