Push Vulcan to Docker Hub on successful test suite run #298
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
name: Push Vulcan to Docker Hub on successful test suite run | |
on: | |
workflow_run: | |
workflows: ["Run Test Suite on Draft Release Creation, Push, and Pull Request to master"] | |
types: [completed] | |
branches: [master] | |
release: | |
types: [published] | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'release' }} | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Checkout the Vulcan Repository | |
uses: actions/checkout@v3 | |
- name: Set tag based on event type | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then | |
TAG="latest" | |
elif [[ "${{ github.event_name }}" == "release" ]]; then | |
TAG="${{ github.event.release.tag_name }}" | |
fi | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: mitre/vulcan:${{ env.TAG }} | |
# platforms: linux/amd64,linux/arm64 |