diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml deleted file mode 100644 index c2a6f8c..0000000 --- a/.gitea/workflows/deploy.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Advertiser console CI and test deployment -on: - push: - branches: [main] - pull_request: - workflow_dispatch: -concurrency: - group: adcloud-advertiser-console-test - cancel-in-progress: false -jobs: - build-deploy: - if: gitea.event_name != 'pull_request' || gitea.event.pull_request.head.repo.full_name == gitea.repository - runs-on: ubuntu-latest - container: - image: docker:27-cli - timeout-minutes: 30 - env: - SOURCE_SERVER: ${{ gitea.server_url }} - SOURCE_REPOSITORY: ${{ gitea.repository }} - SOURCE_REVISION: ${{ gitea.sha }} - DEPLOY_PORT: ${{ vars.ADCLOUD_ADVERTISER_PORT || '18081' }} - BASE_URL: ${{ vars.ADCLOUD_ADVERTISER_PUBLIC_URL || 'http://47.76.92.159:18081' }} - API_UPSTREAM: ${{ vars.ADCLOUD_ADVERTISER_API_UPSTREAM || 'http://host.docker.internal:18080' }} - steps: - - name: Prepare runner tools - run: apk add --no-cache python3 bash curl - - name: Fetch the exact repository revision - env: - SOURCE_TOKEN: ${{ secrets.GITEA_TOKEN || gitea.token }} - run: | - python3 - <<'PY' - import io, os, shutil, tarfile, tempfile, urllib.request - from pathlib import Path - server = os.environ['SOURCE_SERVER'].rstrip('/') - repo = os.environ['SOURCE_REPOSITORY'] - revision = os.environ['SOURCE_REVISION'] - request = urllib.request.Request(server + '/api/v1/repos/' + repo + '/archive/' + revision + '.tar.gz', headers={'Authorization': 'token ' + os.environ['SOURCE_TOKEN']}) - with urllib.request.urlopen(request, timeout=60) as response: - data = response.read() - with tempfile.TemporaryDirectory() as directory: - with tarfile.open(fileobj=io.BytesIO(data), mode='r:gz') as archive: - archive.extractall(directory, filter='data') - roots = list(Path(directory).iterdir()) - if len(roots) != 1 or not roots[0].is_dir(): - raise RuntimeError('Unexpected repository archive structure') - shutil.copytree(roots[0], Path.cwd(), dirs_exist_ok=True) - print('Checked out exact commit:', revision) - PY - - name: Typecheck and build image - run: docker build --tag "adcloud-advertiser:$SOURCE_REVISION" . - - name: Build browser test image - run: docker build --target browser-tests --tag "adcloud-advertiser:$SOURCE_REVISION-tests" . - - name: Stop the retired persistent console - if: gitea.ref == 'refs/heads/main' && gitea.event_name != 'pull_request' - run: | - for container in adcloud-advertiser-console adcloud-advertiser-console-candidate adcloud-advertiser-console-previous - do - docker rm -f "$container" 2>/dev/null || true - done - echo 'Retired advertiser console containers stopped; data and images were preserved.'