Update README.md #15
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: "Deploy Production" | |
on: | |
push: | |
branches: | |
- "master" | |
tags: | |
- v* | |
workflow_dispatch: | |
inputs: | |
tag: | |
required: true | |
description: e.g. v22 | |
jobs: | |
build: | |
uses: ./.github/workflows/build.yml | |
with: | |
for_deploy: true | |
deploy: | |
name: "Deploy" | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: "Download Docker Image Artifacts" | |
uses: actions/download-artifact@v2 | |
with: | |
path: /tmp | |
- name: "Get Tag Name" | |
id: get_tag_name | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.tag }}" != "" ]]; then | |
echo "TAG_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
else | |
echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT | |
fi | |
- name: "Load Docker Images" | |
id: load_images | |
run: | | |
TAGS="" | |
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:${{ steps.get_tag_name.outputs.TAG_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 Manifests" | |
run: | | |
MANIFESTS="mitchtalmadge/amp-dockerized:latest mitchtalmadge/amp-dockerized:${{ steps.get_tag_name.outputs.TAG_NAME }}" | |
for m in ${MANIFESTS}; do | |
docker manifest create ${m} ${{ steps.load_images.outputs.TAGS }} | |
docker manifest push ${m} | |
done |