mirror of
https://code.forgejo.org/actions/checkout.git
synced 2026-07-04 18:46:11 +00:00
69 lines
1.8 KiB
YAML
69 lines
1.8 KiB
YAML
name: deploy-pr
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'app/**'
|
|
- .github/workflows/deploy-pr.yml
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
|
|
jobs:
|
|
build-and-push-image:
|
|
outputs:
|
|
IMAGE_FULL_NAME: ${{ steps.meta.outputs.tags }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ github.repository }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=ref,event=pr
|
|
type=sha
|
|
|
|
- name: Log in to GitHub container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./app
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
update-kubenetes-manifest:
|
|
runs-on: ubuntu-latest
|
|
needs: [build-and-push-image]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Update fastapi-sample image
|
|
env:
|
|
IMAGE_FULL_NAME: ${{ needs.build-and-push-image.outputs.IMAGE_FULL_NAME }}}}
|
|
run: |
|
|
yq -i "(.spec.template.spec.containers[] | select(.name == \"fastapi-sample\")).image = \"$IMAGE_FULL_NAME"" manifest/fasta
|
|
pi-sample/deployment.yaml
|
|
|
|
- name: Create PR
|
|
uses: peter-evans/create-pull-request@v5
|
|
with:
|
|
base: main
|
|
title: "Upagete fasapi-sample"
|
|
draft: true
|
|
body: |
|
|
# Changes
|
|
- Upate 'fastapi-sample' image to ${{ needs.build-and-push-image.outputs.IMAGE_FULL_NAME }}
|