Skip to content

Commit

Permalink
feat: full/Improved pipeline (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryET committed Aug 1, 2023
1 parent d829e18 commit 39235fe
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: publish_image
name: auto_deploy

on:
push:
Expand All @@ -16,10 +16,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Ensure that we get the new version from updated Cargo.toml
- name: Move to HEAD
run: |
git reset --hard HEAD

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down Expand Up @@ -55,6 +52,7 @@ jobs:
with:
images: |
${{ steps.login-ecr.outputs.registry }}/echo-server
ghcr.io/${{ github.repository }}
walletconnect/echo-server,enable=false
flavor: |
latest=auto
Expand All @@ -75,3 +73,13 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
run-ci:
uses: ./.github/workflows/ci.yml
run-cd:
needs:
- build-container
- run-ci
# call the cd.yml file with image tag as the commit hash
uses: ./.github/workflows/cd.yml
with:
image_tag: ${{ github.head_ref }}
13 changes: 11 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
- "terraform/**"
release:
types: ["published"]
workflow_call:
inputs:
image_tag:
type: string
required: true

concurrency:
# Only allow for one action to run at once, queue any others
Expand All @@ -29,14 +34,18 @@ jobs:
result-encoding: string
script: |
if (context.eventName == "release") {
return context.payload.release.tag_name
// remove the v from the tag
let tag = context.payload.release.tag_name.replace("v", "")
return tag
} else if (context.eventName == "workflow_call") {
return context.payload.inputs.image_tag
} else {
return ""
}
- id: clean_version
run: |
version=$(echo "${{ steps.get.outputs.result }}" | sed 's/v//g')
version=$(echo "${{ steps.get.outputs.result }}")
echo "version=$version" >> $GITHUB_OUTPUT
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
- "*.md"
- "LICENSE"

workflow_call:


concurrency:
# Support push/pr as event types with different behaviors each:
# 1. push: queue up builds
Expand Down

0 comments on commit 39235fe

Please sign in to comment.