diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13a2f06..1be7299 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ on: - minor - patch schedule: - - cron: '0 3 * * 1' + - cron: '0 3 * * 1' # Weekly build every Monday at 03:00 UTC push: tags: - 'v*.*.*' @@ -86,12 +86,45 @@ jobs: echo " Date: ${{ steps.version.outputs.build_date }}" echo " SHA: ${{ steps.version.outputs.short_sha }}" + precheck: + name: ๐Ÿงฑ Validate Upstream Workflow + runs-on: ubuntu-latest + needs: determine-version + if: ${{ needs.determine-version.outputs.build_type != 'manual' }} + steps: + - name: ๐Ÿ” Verify Build & Validation Workflow Status + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "โณ Waiting for ๐Ÿงฑ Build & Validation workflow to complete..." + WORKFLOW_NAME="๐Ÿงฑ Build & Validation" + REF=${GITHUB_REF_NAME:-main} + + for i in {1..30}; do + STATUS=$(gh api repos/${{ github.repository }}/actions/runs \ + --jq ".workflow_runs[] | select(.name==\"$WORKFLOW_NAME\" and .head_branch==\"$REF\") | .conclusion" \ + | head -1) + + if [[ "$STATUS" == "success" ]]; then + echo "โœ… Validation passed successfully." + exit 0 + elif [[ "$STATUS" == "failure" ]]; then + echo "โŒ Validation failed. Aborting release." + exit 1 + else + echo "โฑ๏ธ Waiting for validation workflow... ($i/30)" + sleep 20 + fi + done + + echo "โš ๏ธ Timeout: Validation workflow did not complete in time." + exit 1 + build-and-push: name: ๐Ÿณ Multi-Arch Build & Push runs-on: ubuntu-latest - needs: determine-version + needs: [determine-version, precheck] if: ${{ needs.determine-version.result == 'success' }} - steps: - name: ๐Ÿ“ฅ Checkout Repository uses: actions/checkout@v5 @@ -172,30 +205,22 @@ jobs: - name: ๐Ÿ“ฅ Checkout Repository uses: actions/checkout@v5 - - name: ๐Ÿ” Login to GHCR + - name: ๐Ÿ” Login to Registries uses: docker/login-action@v3 with: registry: ${{ env.GHCR_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: ๐Ÿ” Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: ๐Ÿงช Validate Images run: | set -e VERSION="${{ needs.determine-version.outputs.version }}" - BUILD_TYPE="${{ needs.determine-version.outputs.build_type }}" - echo "๐Ÿ” Validating GHCR & Docker Hub images..." + echo "๐Ÿ” Validating published images..." for REG in "${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}" "${{ env.DOCKERHUB_IMAGE_NAME }}"; do IMAGE_TAG="${REG}:${VERSION}" echo "๐Ÿ“ฆ Pulling $IMAGE_TAG" docker pull "$IMAGE_TAG" - echo "๐Ÿง… Checking Tor version..." docker run --rm "$IMAGE_TAG" tor --version | head -1 done diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 2873049..7339fa3 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -10,6 +10,8 @@ on: branches: - main - develop + tags: + - 'v*.*.*' paths: - 'Dockerfile' - 'docker-entrypoint.sh'