smaple yaml code for prevent_merge
This commit is contained in:
parent
0606d6852a
commit
4bc9099276
|
@ -0,0 +1,42 @@
|
||||||
|
name: Build Container Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
# Check if the commit message contains 'BUILD_CONTAINER_IMAGE'
|
||||||
|
paths-ignore:
|
||||||
|
- '.github/workflows/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: |
|
||||||
|
github.event_name == 'push' &&
|
||||||
|
(github.event.head_commit.message contains 'BUILD_CONTAINER_IMAGE' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') ||
|
||||||
|
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- 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_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: <your-dockerhub-username>/guestbook-go:latest
|
Loading…
Reference in New Issue