Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8S Preview Versions #473

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ on:
- "master"
tags:
- "v*"
# pull_request:
# types:
# - 'opened'
# - 'synchronize'
# - 'reopened'
# - 'closed'
# branches:
# - 'develop'
# - 'master'
pull_request:
types:
- 'opened'
- 'synchronize'
- 'reopened'
- 'closed'
branches:
- 'develop'
- 'master'

jobs:
build:
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
id: deploy-tag
run: |
# Parse container image tag to deploy
full_tag=$(echo "$DOCKER_METADATA_OUTPUT_JSON" | jq -r '.tags[] | limit(1; select(. | test(":sha-|:v.")))')
full_tag=$(echo "$DOCKER_METADATA_OUTPUT_JSON" | jq -r '.tags[0]')
echo "Will use tag \"$full_tag\" for deployment."
echo image_tag=$(echo "$full_tag" | cut -f2 -d:) >> "$GITHUB_OUTPUT"
echo image_name=$(echo "$full_tag" | cut -f1 -d:) >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -101,6 +101,20 @@ jobs:
type=gha
build-args: |
RUN_BUILD=false

-
uses: imjasonh/[email protected]
if: ${{ github.event_name == 'pull_request' }}

-
name: Preview prep
if: ${{ github.event_name == 'pull_request' }}
run: |-
API_IMAGE=$(echo "${{ steps.deploy-tag.outputs.image_name }}" | sed -e 's/-client/-api/g')
if ! crane config ${API_IMAGE}:${{ steps.deploy-tag.outputs.image_tag }}; then
crane tag ${API_IMAGE}:latest ${{ steps.deploy-tag.outputs.image_tag }}
fi

- name: Summary
run: |
cat <<-EOT >> "$GITHUB_STEP_SUMMARY"
Expand All @@ -114,6 +128,7 @@ jobs:
name: Trigger deploy to ${{ needs.build.outputs.environment_name }}
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Generate Webhook Payload
id: payload
Expand Down
Loading