Skip to content

Bump djangorestframework from 3.15.0 to 3.15.1 #38

Bump djangorestframework from 3.15.0 to 3.15.1

Bump djangorestframework from 3.15.0 to 3.15.1 #38

name: Create and publish a Docker image on Pull Request comment
on:
issue_comment:
types:
- created
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
PR_NUMBER: ${{ github.event.issue.number }}
jobs:
pr_commented:
name: Deploy Docker image on Pull Request comment
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '!deploy image') &&
contains(github.event.sender.login, github.repository_owner)
runs-on: ubuntu-latest
steps:
- name: Get branch name based on PR
uses: bahmutov/get-branch-name-by-pr@v1
id: pr_data
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-id: ${{ env.PR_NUMBER }}
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ steps.pr_data.outputs.branch }}
- name: Replace slashes with dashes in branch name
id: branch_name_formatted
run: echo "formatted_branch=$(echo ${{ steps.pr_data.outputs.branch }} | sed 's/\//-/g')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
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 }}/${{ env.IMAGE_NAME }}
tags: ${{ steps.branch_name_formatted.outputs.formatted_branch }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: PR Comment
run: |
gh pr comment ${{ github.event.issue.number }} -b "A docker image of the current pull request was deployed: ${{ steps.meta.outputs.tags }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}