-
Notifications
You must be signed in to change notification settings - Fork 23
64 lines (61 loc) · 2.01 KB
/
deploy-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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_ENV
else
echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV
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