Merge pull request #189 from TonyMacDonald1995/master #21
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 Staging" | |
on: | |
push: | |
branches: | |
- "staging*" | |
paths: | |
- Dockerfile | |
- .dockerignore | |
- entrypoint/** | |
- .github/workflows/**.yml | |
jobs: | |
build: | |
if: ${{ startsWith(github.ref, 'refs/heads/staging') }} | |
uses: ./.github/workflows/build.yml | |
with: | |
for_deploy: true | |
deploy: | |
name: "Deploy Staging" | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: "Download Docker Image Artifacts" | |
uses: actions/download-artifact@v2 | |
with: | |
path: /tmp | |
- name: "Get Branch Name" | |
id: get_branch_name | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | |
- 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_branch_name.outputs.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: | | |
MANIFEST="mitchtalmadge/amp-dockerized:${{ steps.get_branch_name.outputs.BRANCH_NAME }}" | |
docker manifest create ${MANIFEST} ${{ steps.load_images.outputs.TAGS }} | |
docker manifest push ${MANIFEST} |