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

Add separate dev layer deploy #16

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
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
39 changes: 29 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
name: 'Deploy'
name: "Deploy"

on:
push:
branches:
- dev
- drunkbatya/separate_dev_layer
tags:
- '*'
- "*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 'Set image tag'
- name: "Set image tag"
id: tag
run: |
IMAGE_TAG="0.0.0"
Expand All @@ -28,31 +29,49 @@ jobs:
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT

- name: 'Set up QEMU'
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v2

- name: 'Set up Docker Buildx'
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2

- name: 'Login to GHCR'
- name: "Login to GHCR"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: 'Build and push'
- name: "Build and push"
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/flipperdevices/flpr.app:${{steps.tag.outputs.image_tag}}

- name: 'Image digest'
- name: "Image digest"
run: |
echo ${{ steps.docker_build.outputs.digest }}

- name: 'Trigger k8s to use new image'
# - name: "Trigger k8s to use new dev image"
# if: ${{ steps.tag.outputs.image_tag == '0.0.0' }}
# uses: peter-evans/repository-dispatch@v2
# with:
# repository: ${{ secrets.INFRASTRUCTURE_REPO_DEV }}
# token: ${{ secrets.K8S_GITHUB_PAT }}
# event-type: flpr-app-deploy
# client-payload: '{"image_tag": "${{steps.tag.outputs.image_tag}}"}'
#
# - name: "Trigger k8s to use new prod image"
# if: ${{ steps.tag.outputs.image_tag != '0.0.0' }}
# uses: peter-evans/repository-dispatch@v2
# with:
# repository: ${{ secrets.INFRASTRUCTURE_REPO }}
# token: ${{ secrets.K8S_GITHUB_PAT }}
# event-type: flpr-app-deploy
# client-payload: '{"image_tag": "${{steps.tag.outputs.image_tag}}"}'

- name: "Trigger k8s to use new image"
uses: peter-evans/repository-dispatch@v2
with:
repository: ${{ secrets.INFRASTRUCTURE_REPO }}
Expand Down
Loading