Skip to content

Commit

Permalink
Update GitHub Actions to Trigger on PR Merge or Direct Push.
Browse files Browse the repository at this point in the history
- Add triggers for PR opened, synchronized, and closed events.
- Modify conditional logic for Docker Hub login and push steps to run only when
  a PR is merged or a direct push occurs.
- Introduce a shell-command-based Docker Hub login step.
- This step is conditional and will only execute if a PR is merged or there is
  a direct push to the branch.

Signed-off-by: Nikolay Martyanov <[email protected]>
  • Loading branch information
mikem-zed committed Oct 17, 2023
1 parent 7576a14 commit 0c3194d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
---
name: eve-kernel build
on: # yamllint disable-line rule:truthy
on:
pull_request_review:
types: [submitted]
pull_request:
types: [opened, synchronize, closed]
push:
branches:
- "eve-kernel-amd64-v6.1.38-generic"

workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
packages:
runs-on: self-hosted
if: github.event.review.state == 'approved'
steps:
- name: Get eve-kernel
uses: actions/checkout@v3
with:
ref: "eve-kernel-amd64-v6.1.38-generic"
- name: Always build eve-kernel-amd64
run: |
make -f Makefile.eve BRANCH?=${GITHUB_REF##*/} kernel-gcc
- name: Log in to Docker Hub
if: ( github.event_name == 'pull_request' && github.event.pull_request.merged == true ) || github.event_name == 'push' # Only if PR is merged or it was direct push
uses: docker/login-action@v3
with:
username: ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}
password: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
- name: Login to DockerHUB
if: ( github.event_name == 'pull_request' && github.event.pull_request.merged == true ) || github.event_name == 'push' # Only if PR is merged or it was direct push
run: |
echo "${{ secrets.RELEASE_DOCKERHUB_TOKEN }}" |\
docker login -u "${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}" --password-stdin
- name: Build eve-kernel-amd64-v6.1.38-generic
- name: Push eve-kernel-amd64-v6.1.38-generic if PR approved or pushed
if: ( github.event_name == 'pull_request' && github.event.pull_request.merged == true ) || github.event_name == 'push' # Only if PR is merged or it was direct push
run: |
make -f Makefile.eve BRANCH?=${GITHUB_REF##*/} push-gcc

0 comments on commit 0c3194d

Please sign in to comment.