Skip to content

Prod deploy only on master #3

Prod deploy only on master

Prod deploy only on master #3

Workflow file for this run

name: "Deploy Staging"
on:
push:
branches:
- "staging*"
paths:
- Dockerfile
- .dockerignore
- entrypoint/**
- .github/workflows/**.yml
jobs:
build:
if: ${{ startsWith(github.ref, 'refs/heads/staging') }}
uses: MitchTalmadge/AMP-dockerized/.github/workflows/build.yml@staging
with:
for_deploy: true
deploy:
name: "Deploy Staging"
runs-on: ubuntu-latest
steps:
- name: "Download Docker Image Artifacts"
uses: actions/download-artifact@v2
with:
path: /tmp
- name: "Load Docker Images"
id: load_images
run: |
TAGS=""
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
for f in $(find /tmp -type f -iname 'docker-image-*.tar' -print); do
ARCH=$(echo ${f} | sed -E 's/.*docker-image-(.*).tar/\1/')
docker load --input ${f}
TAG="mitchtalmadge/amp-dockerized:${BRANCH_NAME}-${ARCH}"
TAGS="${TAGS} ${TAG}"
docker tag amp-dockerized:latest ${TAG}
done
echo "TAGS=${TAGS}" >> $GITHUB_OUTPUT
docker image ls -a
- name: "Login to Docker Hub"
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Deploy to Docker Hub"
run: docker image push --all-tags mitchtalmadge/amp-dockerized
- name: "Deploy Multi-Arch Manifest"
run: |
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
MANIFEST="mitchtalmadge/amp-dockerized:${BRANCH_NAME}"
docker manifest create ${MANIFEST} ${{ steps.load_images.outputs.TAGS }}
docker manifest push ${MANIFEST}