Skip to content

Monitor 1-click Deployment #3

Monitor 1-click Deployment

Monitor 1-click Deployment #3

name: Monitor 1-click Deployment
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'prod'
type: choice
options:
- stage
- prod
originalImageTag:
description: 'The original image tag that has been deployed to dockerhub'
required: true
type: string
env:
DOCKER_IMAGE_NAME: mozilla/blurts-server
jobs:
pull_retag_push:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Pull Docker image
run: docker pull ${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.originalImageTag }}
- name: Retag image
run: docker tag ${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.originalImageTag }} ${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.environment }}-${{ inputs.originalImageTag }}
- name: Redeploy image
run: docker push ${{ env.DOCKER_IMAGE_NAME }}:${{ inputs.environment }}-${{ inputs.originalImageTag }}