Skip to content

update dev

update dev #77

name: Build Docker Image (On PR)
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
branches:
- "dev"
jobs:
build-docker-pr:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | tr / - >> $GITHUB_OUTPUT
id: extract_branch
- name: Build and push pr image
id: docker_build
uses: docker/build-push-action@v3
with:
file: docker/Dockerfile
platforms: linux/amd64
push: true
tags: membermatters/membermatters:untrusted-pr-${{ steps.extract_branch.outputs.branch }}
comment_docker_image:
needs: build-docker-pr
runs-on: ubuntu-latest
steps:
- name: Comment name of docker image
id: comment_docker_image
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Created image with name `membermatters/membermatters:untrusted-pr-${{ needs.build-docker-pr.outputs.branch }}`.'
})