removing .gitattributes on this branch #376
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
# Pulled from Thanatos (https://github.com/MythicAgents/thanatos/blob/rewrite/.github/workflows/image.yml) - MEhrn00 | |
# Name for the Github actions workflow | |
name: Build and push container images | |
on: | |
# Only run workflow when there is a new release published in Github | |
#release: | |
# types: [published] | |
push: | |
branches: | |
- 'Mythic3.3' | |
- 'master' | |
tags: | |
- "v*.*.*" | |
# Variables holding configuration settings | |
env: | |
# Container registry the built container image will be pushed to | |
REGISTRY: ghcr.io | |
# Set the container image name to the Github repository name. (its-a-feature/Mythic) | |
MYTHIC_SERVER_IMAGE_NAME: ${{ github.repository }}_server | |
MYTHIC_CLI_IMAGE_NAME: ${{ github.repository }}_cli | |
MYTHIC_POSTGRES_IMAGE_NAME: ${{ github.repository }}_postgres | |
MYTHIC_RABBITMQ_IMAGE_NAME: ${{ github.repository }}_rabbitmq | |
MYTHIC_DOCUMENTATION_IMAGE_NAME: ${{ github.repository }}_documentation | |
MYTHIC_JUPYTER_IMAGE_NAME: ${{ github.repository }}_jupyter | |
MYTHIC_GRAPHQL_IMAGE_NAME: ${{ github.repository }}_graphql | |
MYTHIC_NGINX_IMAGE_NAME: ${{ github.repository }}_nginx | |
MYTHIC_REACT_IMAGE_NAME: ${{ github.repository }}_react | |
# Description label for the package in Github | |
IMAGE_DESCRIPTION: "test containers for Mythic development. Do not use this version!" | |
# Source URL for the package in Github. This links the Github repository packages list | |
# to this container image | |
IMAGE_SOURCE: ${{ github.server_url }}/${{ github.repository }} | |
# License for the container image | |
IMAGE_LICENSE: BSD-3-Clause | |
# Set the container image version to the Github release tag | |
VERSION: ${{ github.ref_name }} | |
# Branch for pushing release changes | |
RELEASE_BRANCH: master | |
jobs: | |
# Builds the base container image and pushes it to the container registry | |
mythic_server: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# the following are unique to this job | |
- name: Lowercase the server container image name | |
run: echo "MYTHIC_SERVER_IMAGE_NAME=${MYTHIC_SERVER_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Copy version file over | |
run: cp VERSION mythic-docker/src/VERSION | |
- name: Build and push the server container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: mythic-docker | |
file: mythic-docker/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_SERVER_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_SERVER_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
mythic_postgres: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# the following are unique to this job | |
- name: Lowercase the postgres container image name | |
run: echo "MYTHIC_POSTGRES_IMAGE_NAME=${MYTHIC_POSTGRES_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Build and push the postgres container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: postgres-docker | |
file: postgres-docker/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_POSTGRES_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_POSTGRES_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
mythic_rabbitmq: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# the following are unique to this job | |
- name: Lowercase the rabbitmq container image name | |
run: echo "MYTHIC_RABBITMQ_IMAGE_NAME=${MYTHIC_RABBITMQ_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Build and push the rabbitmq container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: rabbitmq-docker | |
file: rabbitmq-docker/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_RABBITMQ_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_RABBITMQ_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
mythic_documentation: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# the following are unique to this job | |
- name: Lowercase the documentation container image name | |
run: echo "MYTHIC_DOCUMENTATION_IMAGE_NAME=${MYTHIC_DOCUMENTATION_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Build and push the documentation container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: documentation-docker | |
file: documentation-docker/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_DOCUMENTATION_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_DOCUMENTATION_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
mythic_jupyter: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# these two are unique | |
- name: Lowercase the jupyter container image name | |
run: echo "MYTHIC_JUPYTER_IMAGE_NAME=${MYTHIC_JUPYTER_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Build and push the jupyter container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: jupyter-docker | |
file: jupyter-docker/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_JUPYTER_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_JUPYTER_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
mythic_graphql: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# these two are unique | |
- name: Lowercase the graphql container image name | |
run: echo "MYTHIC_GRAPHQL_IMAGE_NAME=${MYTHIC_GRAPHQL_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Build and push the graphql container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: hasura-docker | |
file: hasura-docker/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_GRAPHQL_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_GRAPHQL_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
mythic_nginx: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# these two are unique | |
- name: Lowercase the nginx container image name | |
run: echo "MYTHIC_NGINX_IMAGE_NAME=${MYTHIC_NGINX_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Build and push the nginx container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: nginx-docker | |
file: nginx-docker/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_NGINX_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_NGINX_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
mythic_react: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
with: | |
lfs: true | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# these two are unique | |
- name: Lowercase the react container image name | |
run: echo "MYTHIC_REACT_IMAGE_NAME=${MYTHIC_REACT_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Build and push the react container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: mythic-react-docker | |
file: mythic-react-docker/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_REACT_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_REACT_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
# update mythic-cli latest after we're sure all the others build properly | |
mythic_cli: | |
runs-on: ubuntu-latest | |
needs: | |
- mythic_server | |
- mythic_postgres | |
- mythic_rabbitmq | |
- mythic_documentation | |
- mythic_jupyter | |
- mythic_graphql | |
- mythic_nginx | |
- mythic_react | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 # ref: https://github.com/marketplace/actions/docker-login | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# the following are unique to this job | |
- name: Lowercase the cli container image name | |
run: echo "MYTHIC_CLI_IMAGE_NAME=${MYTHIC_CLI_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Fix the mythic_docker_latest reference to reference the new release tag | |
working-directory: Mythic_CLI/src/cmd/config | |
run: | | |
sed -i "s|^const MythicDockerLatest =.*$|const MythicDockerLatest = \"${VERSION}\"|" constants.go | |
- name: Build and push the cli container image | |
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: Mythic_CLI | |
file: Mythic_CLI/.docker/Dockerfile | |
tags: | | |
${{ env.REGISTRY }}/${{ env.MYTHIC_CLI_IMAGE_NAME }}:${{ env.VERSION }} | |
${{ env.REGISTRY }}/${{ env.MYTHIC_CLI_IMAGE_NAME }}:latest | |
push: ${{ github.ref_type == 'tag' }} | |
# These container metadata labels allow configuring the package in Github | |
# packages. The source will link the package to this Github repository | |
labels: | | |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }} | |
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }} | |
platforms: linux/amd64,linux/arm64 | |
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} | |
update_files: | |
runs-on: ubuntu-latest | |
needs: | |
- mythic_server | |
- mythic_cli | |
- mythic_postgres | |
- mythic_rabbitmq | |
- mythic_documentation | |
- mythic_jupyter | |
- mythic_graphql | |
- mythic_nginx | |
- mythic_react | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# Pull in the repository code | |
- name: Checkout the repository | |
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout | |
# update names to lowercase | |
- name: Lowercase the server container image name | |
run: echo "MYTHIC_SERVER_IMAGE_NAME=${MYTHIC_SERVER_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Lowercase the cli container image name | |
run: echo "MYTHIC_CLI_IMAGE_NAME=${MYTHIC_CLI_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Lowercase the postgres container image name | |
run: echo "MYTHIC_POSTGRES_IMAGE_NAME=${MYTHIC_POSTGRES_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Lowercase the rabbitmq container image name | |
run: echo "MYTHIC_RABBITMQ_IMAGE_NAME=${MYTHIC_RABBITMQ_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Lowercase the documentation container image name | |
run: echo "MYTHIC_DOCUMENTATION_IMAGE_NAME=${MYTHIC_DOCUMENTATION_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Lowercase the jupyter container image name | |
run: echo "MYTHIC_JUPYTER_IMAGE_NAME=${MYTHIC_JUPYTER_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Lowercase the graphql container image name | |
run: echo "MYTHIC_GRAPHQL_IMAGE_NAME=${MYTHIC_GRAPHQL_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Lowercase the nginx container image name | |
run: echo "MYTHIC_NGINX_IMAGE_NAME=${MYTHIC_NGINX_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
- name: Lowercase the react container image name | |
run: echo "MYTHIC_REACT_IMAGE_NAME=${MYTHIC_REACT_IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
# The Dockerfile which Mythic uses to pull in the base container image needs to be | |
# updated to reference the newly built container image | |
- name: Fix the server Dockerfile reference to reference the new release tag | |
working-directory: mythic-docker | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_SERVER_IMAGE_NAME}:${VERSION}|" Dockerfile | |
- name: Fix the cli Dockerfile reference to reference the new release tag | |
working-directory: Mythic_CLI | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_CLI_IMAGE_NAME}:${VERSION}|" Dockerfile | |
- name: Fix the cli Makefile reference to reference the new release tag | |
working-directory: Mythic_CLI | |
run: | | |
sed -i "s|^BUILDER_IMAGE=ghcr\.io.*$|BUILDER_IMAGE=${REGISTRY}/${MYTHIC_CLI_IMAGE_NAME}:${VERSION}|" Makefile | |
- name: Fix the mythic_docker_latest reference to reference the new release tag | |
working-directory: Mythic_CLI/src/cmd/config | |
run: | | |
sed -i "s|^const MythicDockerLatest =.*$|const MythicDockerLatest = \"${VERSION}\"|" constants.go | |
- name: Fix the postgres Dockerfile reference to reference the new release tag | |
working-directory: postgres-docker | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_POSTGRES_IMAGE_NAME}:${VERSION}|" Dockerfile | |
- name: Fix the rabbitmq Dockerfile reference to reference the new release tag | |
working-directory: rabbitmq-docker | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_RABBITMQ_IMAGE_NAME}:${VERSION}|" Dockerfile | |
- name: Fix the documentation Dockerfile reference to reference the new release tag | |
working-directory: documentation-docker | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_DOCUMENTATION_IMAGE_NAME}:${VERSION}|" Dockerfile | |
- name: Fix the jupyter Dockerfile reference to reference the new release tag | |
working-directory: jupyter-docker | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_JUPYTER_IMAGE_NAME}:${VERSION}|" Dockerfile | |
- name: Fix the graphql Dockerfile reference to reference the new release tag | |
working-directory: hasura-docker | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_GRAPHQL_IMAGE_NAME}:${VERSION}|" Dockerfile | |
- name: Fix the nginx Dockerfile reference to reference the new release tag | |
working-directory: nginx-docker | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_NGINX_IMAGE_NAME}:${VERSION}|" Dockerfile | |
- name: Fix the react Dockerfile reference to reference the new release tag | |
working-directory: mythic-react-docker | |
run: | | |
sed -i "s|^FROM ghcr\.io.*$|FROM ${REGISTRY}/${MYTHIC_REACT_IMAGE_NAME}:${VERSION}|" Dockerfile | |
# Push the changes to the Dockerfile | |
- name: Push the updated base Dockerfile image reference changes | |
if: ${{ github.ref_type == 'tag' }} | |
uses: EndBug/add-and-commit@v9 # ref: https://github.com/marketplace/actions/add-commit | |
with: | |
# Only add the Dockerfile changes. Nothing else should have been modified | |
add: "['mythic-docker/Dockerfile', 'Mythic_CLI/Dockerfile', 'Mythic_CLI/Makefile', 'Mythic_CLI/src/cmd/config/constants.go', 'postgres-docker/Dockerfile', 'rabbitmq-docker/Dockerfile', 'documentation-docker/Dockerfile', 'jupyter-docker/Dockerfile', 'hasura-docker/Dockerfile', 'nginx-docker/Dockerfile', 'mythic-react-docker/Dockerfile']" | |
# Use the Github actions bot for the commit author | |
default_author: github_actions | |
committer_email: github-actions[bot]@users.noreply.github.com | |
# Set the commit message | |
message: "Bump Mythic Dockerfile tag to match release '${{ env.VERSION }}'" | |
# Overwrite the current git tag with the new changes | |
tag: '${{ env.VERSION }} --force' | |
# Push the new changes with the tag overwriting the current one | |
tag_push: '--force' | |
# Push the commits to the branch marked as the release branch | |
push: origin HEAD:${{ env.RELEASE_BRANCH }} --set-upstream | |
# Have the workflow fail in case there are pathspec issues | |
pathspec_error_handling: exitImmediately |