Skip to content
name: Push Heimdall Server to Docker Hub on every release and tag as release-latest and version
on:
release:
types: [published]
jobs:
docker:
runs-on: ubuntu-22.04
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: Run string replace # remove the v from the version number before using it in the docker tag
uses: frabert/replace-string-action@master
id: format-tag
with:
pattern: 'v'
string: '${{ github.event.release.tag_name }}'
replace-with: ''
flags: 'g'
- name: Checkout the Heimdall Repository
uses: actions/checkout@v3
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: 'linux/amd64'
tags: mitre/heimdall2:release-latest,mitre/heimdall2:${{ steps.format-tag.outputs.replaced }}
- name: Get Docker SHA
shell: bash
id: get-docker-sha
run: echo "DOCKER_SHA=$(docker manifest inspect --verbose docker.io/mitre/heimdall2:${{ steps.format-tag.outputs.replaced }} | jq -r '.Descriptor.digest')" >> $GITHUB_ENV
- name: Sophos Factory pipeline
uses: sophos/factory-run-pipeline@v2
with:
project_id: 601c48ad71a5df94e698a9ad
job_id: 644185303992f67e1d9412f2
api_token: ${{ secrets.SOPHOS_FACTORY_TOKEN }}
variables: |
{
"gitlabHost": "repo1.dso.mil",
"heimdallVersion": "${{ steps.format-tag.outputs.replaced }}",
"heimdallDockerURL": "docker://docker.io/mitre/heimdall2@${{ env.DOCKER_SHA }}"
}