1919 matrix :
2020 python-version : ["3.9", "3.10", "3.11", "3.12", "3.13"]
2121 steps :
22- - uses : actions/checkout@v5
22+ - uses : actions/checkout@v6
2323 - name : Set up Python
2424 uses : actions/setup-python@v6
2525 with :
3939 poetry run pytest -vv --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot .
4040 - name : Upload Debug Logs
4141 if : always()
42- uses : actions/upload-artifact@v4
42+ uses : actions/upload-artifact@v6
4343 with :
4444 name : pytest-debug-logs-${{ env.PYTHON_VERSION }}
4545 path : pytest_debug.log
5555 if : github.event_name == 'push' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/stable')
5656 continue-on-error : true
5757 steps :
58- - uses : actions/checkout@v5
58+ - uses : actions/checkout@v6
5959 with :
6060 fetch-depth : 0
61+ - name : Set up Docker Buildx
62+ uses : docker/setup-buildx-action@v3
63+ - name : Login to Docker Hub
64+ uses : docker/login-action@v3
65+ with :
66+ username : ${{ secrets.DOCKER_USERNAME }}
67+ password : ${{ secrets.DOCKER_PASSWORD }}
6168 - name : Set up Python
6269 uses : actions/setup-python@v6
6370 with :
@@ -77,44 +84,111 @@ jobs:
7784 password : ${{ secrets.PYPI_API_TOKEN }}
7885 - name : Get BBOT version
7986 id : version
80- run : echo "BBOT_VERSION=$(poetry version | cut -d' ' -f2)" >> $GITHUB_OUTPUT
87+ run : |
88+ FULL_VERSION=$(poetry version | cut -d' ' -f2)
89+ echo "BBOT_VERSION=$FULL_VERSION" >> $GITHUB_OUTPUT
90+ # Extract major.minor (e.g., 2.7 from 2.7.1)
91+ MAJOR_MINOR=$(echo "$FULL_VERSION" | cut -d'.' -f1-2)
92+ echo "BBOT_VERSION_MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_OUTPUT
93+ # Extract major (e.g., 2 from 2.7.1)
94+ MAJOR=$(echo "$FULL_VERSION" | cut -d'.' -f1)
95+ echo "BBOT_VERSION_MAJOR=$MAJOR" >> $GITHUB_OUTPUT
8196 - name : Publish to Docker Hub (dev)
8297 if : github.event_name == 'push' && github.ref == 'refs/heads/dev'
83- uses : elgohr/Publish-Docker-Github-Action@v5
98+ uses : docker/build-push-action@v6
8499 with :
85- name : blacklanternsecurity/bbot
86- username : ${{ secrets.DOCKER_USERNAME }}
87- password : ${{ secrets.DOCKER_PASSWORD }}
88- tags : " latest,dev,${{ steps.version.outputs.BBOT_VERSION }}"
100+ push : true
101+ context : .
102+ tags : |
103+ blacklanternsecurity/bbot:latest
104+ blacklanternsecurity/bbot:dev
105+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION }}
106+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION_MAJOR_MINOR }}
107+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION_MAJOR }}
89108 - name : Publish to Docker Hub (stable)
90109 if : github.event_name == 'push' && github.ref == 'refs/heads/stable'
91- uses : elgohr/Publish-Docker-Github-Action@v5
110+ uses : docker/build-push-action@v6
92111 with :
93- name : blacklanternsecurity/bbot
94- username : ${{ secrets.DOCKER_USERNAME }}
95- password : ${{ secrets.DOCKER_PASSWORD }}
96- tags : " stable,${{ steps.version.outputs.BBOT_VERSION }}"
112+ push : true
113+ context : .
114+ tags : |
115+ blacklanternsecurity/bbot:stable
116+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION }}
117+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION_MAJOR_MINOR }}
118+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION_MAJOR }}
119+ - name : Publish Full Docker Image to Docker Hub (dev)
120+ if : github.event_name == 'push' && github.ref == 'refs/heads/dev'
121+ uses : docker/build-push-action@v6
122+ with :
123+ push : true
124+ file : Dockerfile.full
125+ context : .
126+ tags : |
127+ blacklanternsecurity/bbot:latest-full
128+ blacklanternsecurity/bbot:dev-full
129+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION }}-full
130+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION_MAJOR_MINOR }}-full
131+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION_MAJOR }}-full
132+ - name : Publish Full Docker Image to Docker Hub (stable)
133+ if : github.event_name == 'push' && github.ref == 'refs/heads/stable'
134+ uses : docker/build-push-action@v6
135+ with :
136+ push : true
137+ file : Dockerfile.full
138+ context : .
139+ tags : |
140+ blacklanternsecurity/bbot:stable-full
141+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION }}-full
142+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION_MAJOR_MINOR }}-full
143+ blacklanternsecurity/bbot:${{ steps.version.outputs.BBOT_VERSION_MAJOR }}-full
97144 - name : Docker Hub Description
98145 if : github.event_name == 'push' && github.ref == 'refs/heads/dev'
99146 uses : peter-evans/dockerhub-description@v5
100147 with :
101148 username : ${{ secrets.DOCKER_USERNAME }}
102149 password : ${{ secrets.DOCKER_PASSWORD }}
103150 repository : blacklanternsecurity/bbot
151+ - name : Clean up old Docker Hub tags (up to 50 most recent tags plus 'latest')
152+ if : github.event_name == 'push' && github.ref == 'refs/heads/dev'
153+ run : |
154+ # Install jq for JSON processing
155+ sudo apt-get update && sudo apt-get install -y jq
156+
157+ IMAGE="blacklanternsecurity/bbot"
158+
159+ # Clean up dev tags (keep 50 most recent)
160+ for tag_pattern in "rc$" "rc-full$"; do
161+ echo "Cleaning up tags ending with $tag_pattern..."
162+
163+ tags_response=$(curl -s -H "Authorization: Bearer ${{ secrets.DOCKER_TOKEN }}" \
164+ "https://hub.docker.com/v2/repositories/$IMAGE/tags/?page_size=100")
165+
166+ tags_to_delete=$(echo "$tags_response" | jq -r --arg pattern "$tag_pattern" \
167+ '.results[] | select(.name | test($pattern)) | [.last_updated, .name] | @tsv' | \
168+ sort -r | tail -n +51 | cut -f2)
169+
170+ for tag in $tags_to_delete; do
171+ echo "Deleting $IMAGE tag: $tag"
172+ curl -X DELETE -H "Authorization: Bearer ${{ secrets.DOCKER_TOKEN }}" \
173+ "https://hub.docker.com/v2/repositories/$IMAGE/tags/$tag/"
174+ done
175+
176+ echo "Cleanup completed for tags ending with $tag_pattern. Kept 50 most recent."
177+ done
104178 outputs :
105179 BBOT_VERSION : ${{ steps.version.outputs.BBOT_VERSION }}
106180 publish_docs :
107181 runs-on : ubuntu-latest
108182 if : github.event_name == 'push' && (github.ref == 'refs/heads/stable' || github.ref == 'refs/heads/dev')
109183 steps :
110- - uses : actions/checkout@v5
184+ - uses : actions/checkout@v6
111185 with :
112186 token : ${{ secrets.BBOT_DOCS_UPDATER_PAT }}
113187 - uses : actions/setup-python@v6
114188 with :
115189 python-version : " 3.11"
116190 - run : echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
117- - uses : actions/cache@v4
191+ - uses : actions/cache@v5
118192 with :
119193 key : mkdocs-material-${{ env.cache_id }}
120194 path : .cache
@@ -151,7 +225,7 @@ jobs:
151225 # runs-on: ubuntu-latest
152226 # if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
153227 # steps:
154- # - uses: actions/checkout@v5
228+ # - uses: actions/checkout@v6
155229 # with:
156230 # ref: ${{ github.head_ref }}
157231 # fetch-depth: 0 # Fetch all history for all tags and branches
0 commit comments