Skip to content

Commit

Permalink
Add workflow images
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 committed Oct 9, 2021
1 parent 86a5667 commit 54b7345
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/pr-build-container-images-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: PR build container images comment

on:
pull_request_target:
types: [ opened ]

jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Thanks for your contribution! \n Every commit will generate a new build at https://github.com/${{github.event.pull_request.head.repo.full_name}}/actions/workflows/pr-build-container-images.yml?query=branch%3A${{github.event.pull_request.head.ref}} and once the build finishes you should be able to use the container image `ghcr.io/${{github.event.pull_request.head.repo.full_name}}/${{github.event.repository.name}}:${{github.event.pull_request.head.ref}}` \n To see the full set of container images generated visit https://github.com/${{github.event.pull_request.head.repo.full_name}}/packages'
})
31 changes: 31 additions & 0 deletions .github/workflows/pr-build-container-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR build container images

on: [ push ]

jobs:
container-images:
if: ${{ github.event_name != 'pull_request' && github.repository_owner != 'project-openubl' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
cache: maven
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Build and Push to GitHub Packages
run: |
mvn package \
-Pnative -Dquarkus.container-image.build=true -DskipTests \
-Dquarkus.container-image.push=true \
-Dquarkus.container-image.group=${{ github.repository_owner }} \
-Dquarkus.container-image.name=${{ github.event.repository.name }}/ublhub \
-Dquarkus.container-image.tag=${{ steps.extract_branch.outputs.branch }} \
-Dquarkus.container-image.registry=ghcr.io \
-Dquarkus.container-image.username=${{ github.actor }} \
-Dquarkus.container-image.password=${{ secrets.GITHUB_TOKEN }}

0 comments on commit 54b7345

Please sign in to comment.