Workflow file for this run
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 Heimdall Server to Docker Hub on every release and tag as release-latest and version | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: true | |
jobs: | |
docker: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
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@v2 | |
id: format-tag | |
with: | |
pattern: 'v' | |
string: '${{ github.event.release.tag_name || github.event.inputs.version}}' | |
replace-with: '' | |
flags: 'g' | |
- name: Checkout the Heimdall Repository | |
uses: actions/checkout@v4 | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
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 pull mitre/heimdall2:${{ steps.format-tag.outputs.replaced }} > /dev/null 2>&1 && docker inspect --format='{{index .RepoDigests 0}}' mitre/heimdall2:${{ steps.format-tag.outputs.replaced }} | cut -d '@' -f 2)" >> $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 }}" | |
} |