-
Notifications
You must be signed in to change notification settings - Fork 16
40 lines (38 loc) · 1.34 KB
/
push-to-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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