Skip to content
Snippets Groups Projects
Unverified Commit 351dd804 authored by Joel Takvorian's avatar Joel Takvorian Committed by GitHub
Browse files

Merge pull request #11 from jotak/pre-merge-image

NETOBSERV-229 create pre-merge image on PR via action
parents e397ca1c 0fc8c227
Branches
Tags
No related merge requests found
name: push to quay.io
name: Build and push to quay.io
on:
push:
branches: [ main ]
......
name: Build and push PR image to quay.io
on:
pull_request_target:
types: [labeled]
env:
REGISTRY_USER: netobserv+github_ci
REGISTRY: quay.io/netobserv
IMAGE: netobserv-agent
IMAGE_ORG: netobserv
jobs:
push-pr-image:
if: ${{ github.event.label.name == 'ok-to-test' }}
name: push PR image
runs-on: ubuntu-20.04
strategy:
matrix:
go: ['1.17']
steps:
- name: install make
run: sudo apt-get install make
- name: set up go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: checkout
uses: actions/checkout@v2
with:
ref: "refs/pull/${{ github.event.number }}/merge"
- name: build images
run: SW_VERSION=temp make ci-images-build
- name: podman login to quay.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ secrets.QUAY_SECRET }}
registry: quay.io
- name: get short sha
id: shortsha
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
- name: push to quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.IMAGE }}
tags: ${{ steps.shortsha.outputs.short_sha }}
registry: ${{ env.REGISTRY }}
- uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'New image: ${{ steps.push-to-quay.outputs.registry-paths }}. It will expire after two weeks.'
})
name: Remove ok-to-test
on:
pull_request_target:
types: [synchronize,reopened]
jobs:
rm-ok-to-test:
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test')
runs-on: ubuntu-20.04
name: Remove ok-to-test
steps:
- uses: actions-ecosystem/action-remove-labels@v1
with:
labels: ok-to-test
fail_on_error: true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment