Skip to content

Commit

Permalink
chore: attempting to fix pr building (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebauman authored Nov 8, 2024
1 parent aca8ac2 commit 29ecc03
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 19 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
name: Build Images for PRs
on:
pull_request:
pull_request_target:
types:
- synchronize
branches:
- 'main'

jobs:
buildx:
runs-on: ubuntu-latest
Expand All @@ -16,25 +17,15 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
- name: Build and store
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: "hobbyfarm/hf-provisioner-digitalocean:${{ github.event.pull_request.head.sha }}"
- name: Comment
uses: actions/github-script@v7
tags: "hobbyfarm/hf-provisioner-digitalocean:pr-${{ github.event.pull_request.head.sha }}"
outputs: type=oci,dest=/image.tar
- name: Archive build artifact
uses: actions/upload-artifact@v4
with:
github-token: ${{ secrets.DEMETER_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'An image has been built, my little sprouts. Find it here: hobbyfarm/hf-provisioner-digitalocean:${{ github.event.pull_request.head.sha }}'
})
name: oci-image
path: /image.tar
retention-days: 1
42 changes: 42 additions & 0 deletions .github/workflows/pr-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Push and comment PR build
on:
workflow_run:
workflows:
- "Build Images for PRs"
types:
- completed
jobs:
push:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success'
steps:
- name: Load artifact
uses: actions/download-artifact@v4
with:
name: oci-image
path: /oci-image.tar
- name: Login to Docker hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Load image
run: |
docker load --input /oci-image.tar
docker image ls -a
- name: Docker push image
run: |
docker push hobbyfarm/hf-provisioner-digitalocean:${{ github.event.pull_request.head.sha }}
- name: Comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.DEMETER_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'An image has been built, my little sprouts. Find it here: hobbyfarm/hf-provisioner-digitalocean:${{ github.event.pull_request.head.sha }}'
})

0 comments on commit 29ecc03

Please sign in to comment.