Skip to content

Commit

Permalink
added workflow (will probably fail)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulseghers committed Feb 23, 2024
1 parent 4fdc5ff commit 713f3a4
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Docker CI/CD

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

# You must set your full image name here in the format dockerOrganization/dockerRepository
# For example: dfdsdk/hello
env:
IMAGE_NAME: dfdsdk/pgup

jobs:
test:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Test building image
uses: docker/build-push-action@v2
with:
context: .
push: false

publish:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Docker meta for latest
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
flavor: |
latest=true
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# This currently does not work, due to https://github.com/peter-evans/dockerhub-description/issues/10
# - name: Publish README.md to Docker Hub
# uses: peter-evans/dockerhub-description@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# repository: ${{ env.IMAGE_NAME }}
# short-description: ${{ github.event.repository.description }}

0 comments on commit 713f3a4

Please sign in to comment.