Skip to content

Commit

Permalink
feat(ci): release to prod ii (#1467)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts authored Aug 2, 2024
1 parent 217863f commit 83292d4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 37 deletions.
39 changes: 31 additions & 8 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,35 @@ jobs:
tag: ${{ needs.init.outputs.pr }}
target: test

deploy-prod:
name: PROD
promote:
name: Promote Images
env:
target: ${{ needs.init.outputs.pr }}
tag: prod
needs: [init, deploys]
secrets: inherit
uses: ./.github/workflows/.deploy.yml
with:
environment: prod
tag: ${{ needs.init.outputs.pr }}
target: prod
runs-on: ubuntu-latest
strategy:
matrix:
package: [backend, common, database, frontend, oracle-api, sync]
steps:
- uses: shrink/actions-docker-registry-tag@v4
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: ${{ env.target }}
tags: ${{ env.tag }}

- run: |
# Verify tagging
INSPECT="docker manifest inspect ghcr.io/${{ github.repository }}/${{ matrix.package }}"
TARGET=$(${INSPECT}:${{ env.target }} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
TAG=$(${INSPECT}:${{ env.tag }} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
echo "TARGET: ${TARGET}"
echo "TAG: ${TAG}"
if [ "${TARGET}" != "${TAG}" ]; then
echo "ERROR: Tagging failed!"
echo "RETRY=true" >> $GITHUB_ENV
else
echo "ERROR: Tagging success!"
echo "RETRY=false" >> $GITHUB_ENV
fi
44 changes: 15 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,25 @@
name: Release
name: PROD

on:
release:
types: [published, updated]
types: [published]
workflow_call:
inputs:
tag:
description: 'The tag set to deploy; e.g. prod or PR number'
required: true

concurrency:
# Do not interrupt previous workflows
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
dump:
name: Dump Contexts
runs-on: ubuntu-latest
steps:
- name: Debug GitHub Action
uses: raven-actions/debug@v1.1.0

# init:
# name: Initialize
# outputs:
# pr: ${{ steps.pr.outputs.pr }}
# runs-on: ubuntu-latest
# steps:
# # Get PR number for squash merges to main
# - name: PR Number
# id: pr
# uses: bcgov-nr/action-get-pr@v0.0.1

# deploy-prod:
# name: PROD
# needs: [init]
# secrets: inherit
# uses: ./.github/workflows/.deploy.yml
# with:
# environment: prod
# tag: ${{ needs.init.outputs.pr }}
# target: prod
deploy-prod:
name: PROD
secrets: inherit
uses: ./.github/workflows/.deploy.yml
with:
environment: prod
tag: ${{ inputs.tag || prod }}
target: prod

0 comments on commit 83292d4

Please sign in to comment.