| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- # on:
- # workflow_dispatch:
- on:
- push:
- workflow_dispatch:
- jobs:
- central_controller:
- name: Central Controller Build
- strategy:
- matrix:
- runner: [gha-runner-x64, gha-runner-arm64]
- runs-on: ${{ matrix.runner }}
- steps:
- - name: checkout
- uses: actions/checkout@v4
- - name: Set up GCloud CLI
- uses: google-github-actions/setup-gcloud@v2
- - name: Docker Auth
- run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
-
- # - name: Setup Miniconda
- # uses: conda-incubator/setup-miniconda@v3
- # with:
- # miniconda-version: latest
- # activate-environment: central_controller
- # - name: Conda Environment Cache
- # id: cache
- # uses: actions/cache@v4
- # with:
- # path: ${{ env.CONDA }}/envs
- # key: ${{ runner.os }}-${{ runner.arch }}-${{ github.ref_name }}-conda-${{ hashFiles('environment.yml') }}
- # - name: Update Conda Environment
- # if: steps.cache.outputs.cache-hit != 'true'
- # run: |
- # source ~/miniconda3/etc/profile.d/conda.sh
- # conda env update --file environment.yml
- # - name: Build
- # run: |
- # source ~/miniconda3/etc/profile.d/conda.sh
- # conda activate central_controller
- # cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DZT1_CENTRAL_CONTROLLER=1
- # cmake --build build/ --target all -j4 --verbose
- # - name: SelfTest
- # run: |
- # ./build/zerotier-selftest
- - name: Get branch name and sanitize
- id: branch
- run: |
- BRANCH_NAME="${GITHUB_REF##*/}"
- SANITIZED_BRANCH="${BRANCH_NAME//\//-}"
- echo "branch_name=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT
-
- - name: Get short git commit SHA
- id: sha
- run: |
- calculatedSha=$(git rev-parse --short ${{ github.sha }})
- echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- - name: Build
- run: |
- docker build -t us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-${{ runner.arch }} -f ext/central-controller-docker/Dockerfile.new .
- - name: GCP Auth
- uses: google-github-actions/auth@v2
- with:
- credentials_json: ${{ secrets.DOCKER_REGISTRY_WRITER}}
-
- - name: Build and push Docker Image
- run: |
- docker push us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-${{ runner.arch }}
-
- multi-arch-docker:
- runs-on: gha-runner-x64
- needs: central_controller
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: GCP Auth
- uses: google-github-actions/auth@v2
- with:
- credentials_json: ${{ secrets.DOCKER_REGISTRY_WRITER}}
- - name: Set up GCloud CLI
- uses: google-github-actions/setup-gcloud@v2
- - name: Docker Auth
- run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- - name: Get branch name and sanitize
- id: branch
- run: |
- BRANCH_NAME="${GITHUB_REF##*/}"
- SANITIZED_BRANCH="${BRANCH_NAME//\//-}"
- echo "branch_name=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT
-
- - name: Get short git commit SHA
- id: sha
- run: |
- calculatedSha=$(git rev-parse --short ${{ github.sha }})
- echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- - name: Create and push multi-arch manifest
- run: |
- docker manifest create us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }} \
- --amend us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-X64 \
- --amend us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-ARM64
- docker manifest push us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}
|