-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
149 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
app-name: | ||
required: true | ||
type: string | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-publish-image: | ||
name: "Build and publish image" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: ${{ inputs.app-name }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ inputs.app-name }} | ||
tags: type=match,pattern=${{ inputs.app-name }}-v(.*),group=1 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./${{ inputs.app-name }} | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
app-name: | ||
required: true | ||
type: string | ||
secrets: | ||
ssh-host: | ||
required: true | ||
ssh-username: | ||
required: true | ||
ssh-priv-key: | ||
required: true | ||
secret-key-base: | ||
required: true | ||
phx-host: | ||
required: true | ||
ice-port-range: | ||
required: true | ||
|
||
jobs: | ||
deploy-image: | ||
name: Deploy image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: ${{ inputs.app-name }} | ||
|
||
- name: Run docker via remote SSH | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.ssh-host }} | ||
username: ${{ secrets.ssh-username }} | ||
key: ${{ secrets.ssh-priv-key }} | ||
script: | | ||
export TAG=${{ github.ref_name }} | ||
export TAG=${TAG#*-v} | ||
docker stop ${{ inputs.app-name }} | ||
docker rm ${{ inputs.app-name }} | ||
docker run -d --restart unless-stopped --name ${{ inputs.app-name }} -e SECRET_KEY_BASE=${{ secrets.secret-key-base }} -e PHX_HOST=${{ secrets.phx-host }} -e ICE_PORT_RANGE=${{ secrets.ice-port-range }} --network host ghcr.io/elixir-webrtc/apps/${{ inputs.app-name }}:${TAG} | ||
docker image prune --all --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Recognizer CD | ||
|
||
on: | ||
push: | ||
tags: | ||
- "recognizer-v*.*.*" | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build-publish-recognizer-image: | ||
name: "Build and publish Recognizer image" | ||
uses: ./.github/workflows/__CD__build-publish-image.yml | ||
with: | ||
app-name: recognizer | ||
deploy-recognizer: | ||
name: "Deploy Recognizer image" | ||
needs: build-publish-recognizer-image | ||
uses: ./.github/workflows/__CD__deploy-image.yml | ||
with: | ||
app-name: recognizer | ||
secrets: | ||
ssh-host: ${{ secrets.RECOGNIZER_SSH_HOST }} | ||
ssh-username: ${{ secrets.RECOGNIZER_SSH_USERNAME }} | ||
ssh-priv-key: ${{ secrets.RECOGNIZER_SSH_PRIV_KEY }} | ||
secret-key-base: ${{ secrets.RECOGNIZER_SECRET_KEY_BASE }} | ||
phx-host: ${{ secrets.RECOGNIZER_PHX_HOST }} | ||
ice-port-range: ${{ secrets.RECOGNIZER_ICE_PORT_RANGE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters