Update go-openapi packages #665
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Container Image | |
on: | |
push: | |
pull_request_target: | |
jobs: | |
build: | |
name: Build & Publish | |
runs-on: ubuntu-20.04 | |
# run on same-repo pushes or forks | |
# this avoids running the action twice for | |
# pull requests from same-repo branches | |
if: ${{ github.event_name == 'push' || github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name }} | |
steps: | |
- name: Compute Labels | |
if: ${{ github.event_name == 'push' }} | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: quay.io/ffddorf/unms-exporter | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
labels: | | |
org.opencontainers.image.url=https://github.com/ffddorf/unms-exporter | |
org.opencontainers.image.source=https://github.com/ffddorf/unms-exporter | |
org.opencontainers.image.revision=45bf621f0ff5cbc7f04d51f5899220b83f088b4d | |
- id: short-sha | |
if: ${{ github.event_name == 'pull_request_target' }} | |
uses: actions/[email protected] | |
with: | |
script: | | |
const sha = context.payload.pull_request.head.sha.substr(0,7) | |
core.setOutput('sha', sha) | |
- name: Compute Labels for fork | |
if: ${{ github.event_name == 'pull_request_target' }} | |
id: forkmeta | |
uses: docker/metadata-action@v4 | |
with: | |
images: quay.io/ffddorf/unms-exporter | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=pr | |
type=raw,sha-${{ steps.short-sha.outputs.sha }} | |
labels: | | |
org.opencontainers.image.url=https://github.com/${{ github.event.pull_request.head.repo.full_name }} | |
org.opencontainers.image.source=https://github.com/${{ github.event.pull_request.head.repo.full_name }} | |
org.opencontainers.image.revision=${{ github.event.pull_request.head.sha }} | |
- name: Login to Quay | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ffddorf+github_actions | |
password: ${{ secrets.QUAY_BOT_PASSWORD }} | |
- name: Build Image | |
if: ${{ github.event_name == 'push' }} | |
uses: docker/build-push-action@v4 | |
with: | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: true | |
- name: Build Image for fork PR | |
if: ${{ github.event_name == 'pull_request_target' }} | |
uses: docker/build-push-action@v4 | |
with: | |
context: https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git#${{ github.event.pull_request.head.sha }} | |
tags: ${{ steps.forkmeta.outputs.tags }} | |
labels: ${{ steps.forkmeta.outputs.labels }} | |
push: true |