70 lines
2 KiB
YAML
70 lines
2 KiB
YAML
name: Docker
|
|
|
|
# This workflow uses actions that are not certified by GitHub.
|
|
# They are provided by a third-party and are governed by
|
|
# separate terms of service, privacy policy, and support
|
|
# documentation.
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["E2E"]
|
|
types: [completed]
|
|
branches: [master]
|
|
tags: [ 'v*.*.*' ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: dotnet/nbgv@master
|
|
with:
|
|
setAllVars: true
|
|
|
|
# Login against a Docker registry except on PR
|
|
# https://github.com/docker/login-action
|
|
- name: Log into registry docker hub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Extract metadata (tags, labels) for Docker
|
|
# https://github.com/docker/metadata-action
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: |
|
|
farmer1992/sshpiperd
|
|
ghcr.io/${{ github.repository }}
|
|
flavor: |
|
|
latest=true
|
|
|
|
# Build and push Docker image with Buildx (don't push on PR)
|
|
# https://github.com/docker/build-push-action
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
build-args: VER=${{ env.NBGV_SimpleVersion }}
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|