Skip to content

Commit

Permalink
Merge pull request #179 from MitchTalmadge/staging
Browse files Browse the repository at this point in the history
v22 Release
MitchTalmadge authored Nov 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 20a774d + d3c25a0 commit 5953169
Showing 11 changed files with 381 additions and 344 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/auto-deploy-staging.yml

This file was deleted.

22 changes: 7 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -7,47 +7,39 @@ on:
required: true
type: boolean
workflow_dispatch:
push:
paths:
- Dockerfile
- .dockerignore
- entrypoint/**
- .github/workflows/build.yml
pull_request:
paths:
- Dockerfile
- .dockerignore
- entrypoint/**
- .github/workflows/build.yml
- .github/workflows/**.yml

jobs:
build:
name: "Build"
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64]
arch: [amd64,arm64]
steps:
- name: "Checkout Git Repo"
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: "Build Docker Image"
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
build-args: |
"CACHE_AMP_UPGRADE=${{ inputs.for_deploy == true }}"
context: .
platforms: linux/${{ matrix.arch }}
tags: amp-dockerized:latest
outputs: type=docker,dest=/tmp/docker-image-${{ matrix.arch }}.tar
- name: "Upload Docker Image Artifact"
if: ${{ inputs.for_deploy == true }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: image-${{ matrix.arch }}
path: /tmp/docker-image-${{ matrix.arch }}.tar
87 changes: 0 additions & 87 deletions .github/workflows/check-for-updates.yml

This file was deleted.

68 changes: 30 additions & 38 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,54 @@
name: "Deploy Production"

on:
workflow_call:
inputs:
git_release_version:
required: true
type: string
amp_core_version:
required: true
type: string
amp_instmgr_version:
required: true
type: string
amp_last_modified:
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
push:
branches:
- "master"
tags:
- v*

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: "Load Docker Image"
- name: "Get Tag Name"
id: get_tag_name
run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV
- name: "Load Docker Images"
id: load_images
run: |
for f in $(find /tmp -type f -iname 'docker-image*.tar' -print); do
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: "Tag Docker Images"
run: |
docker tag amp-dockerized:latest mitchtalmadge/amp-dockerized:latest
docker tag amp-dockerized:latest mitchtalmadge/amp-dockerized:${{inputs.git_release_version}}
docker tag amp-dockerized:latest mitchtalmadge/amp-dockerized:${{inputs.git_release_version}}-ampcore${{inputs.amp_core_version}}-ampinstmgr${{inputs.amp_instmgr_version}}
docker tag amp-dockerized:latest mitchtalmadge/amp-dockerized:${{inputs.git_release_version}}-ampcore${{inputs.amp_core_version}}-ampinstmgr${{inputs.amp_instmgr_version}}-${{inputs.amp_last_modified}}
- name: "Checkout Git Repo"
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: "Commit Git Tag"
run: |
git config user.name github-actions
git config user.email github-actions@github.com
TAG=${{inputs.git_release_version}}-ampcore${{inputs.amp_core_version}}-ampinstmgr${{inputs.amp_instmgr_version}}-${{inputs.amp_last_modified}}
git tag -a "${TAG}" -m "Auto Release Latest AMP Version" || { echo "Tag already exists"; exit; }
git push --follow-tags
- 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
42 changes: 30 additions & 12 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,55 @@
name: "Deploy Staging"

on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
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: "Load Docker Images"
id: load_images
run: |
for f in $(find /tmp -type f -iname 'docker-image*.tar' -print); do
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: "Extract Branch Name"
id: extract_branch
run: echo "::set-output name=name::$(echo ${GITHUB_REF#refs/heads/})"
- name: "Tag Docker Image"
run: docker tag amp-dockerized:latest mitchtalmadge/amp-dockerized:${{ steps.extract_branch.outputs.name }}
- 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}
Loading

0 comments on commit 5953169

Please sign in to comment.