Skip to content

Commit

Permalink
refactor lynx docker workflow as 'reusable'
Browse files Browse the repository at this point in the history
  • Loading branch information
KPrasch committed Feb 14, 2024
1 parent 4c571ba commit 1fbe9a0
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/lynx-docker.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Publish Lynx Docker Image
name: '🐳 Publish Lynx to DockerHub'

on:
push:
tags: [ 'v*.*.*' ]
branches:
- 'v*.*.*'
pull_request:
types:
- labeled
workflow_call:
inputs:
docker_username:
required: true
type: string
docker_password:
required: true
type: secret

jobs:
docker:
Expand All @@ -23,8 +24,8 @@ jobs:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
username: ${{ inputs.docker_username }}
password: ${{ inputs.docker_password }}

- name: Update Development Package Metadata
if: ${{ github.ref_type == 'branch' }}
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/lynx-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: '🥼🐳 Publish Lynx Experimental'

on:
pull_request:
types: [opened, synchronize]
branches:
- v*.*.*
- epic-*

jobs:
lynx-docker:
runs-on: ubuntu-latest
if: github.event.pull_request.labels.*.name == 'lynx'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Print a message if 'lynx' label is present
run: echo "The 'lynx' label is present. Proceeding with Docker build and push operations."

- name: Call Docker Workflow if Label is Present
if: steps.label-check.outputs.has-lynx-label == 'true'
uses: ./.github/workflows/lynx-docker.yml@main
with:
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}
25 changes: 25 additions & 0 deletions .github/workflows/pr-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: '🔀 Merge Pull Request'

on:
push:
tags: [ 'v*.*.*' ]
branches:
- 'v*.*.*'

jobs:
lynx-docker:
runs-on: ubuntu-latest
if: github.event.pull_request.labels.*.name == 'lynx'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Print a message if 'lynx' label is present
run: echo "The 'lynx' label is present. Proceeding with Docker build and push operations."

- name: Call Docker Workflow if Label is Present
if: steps.label-check.outputs.has-lynx-label == 'true'
uses: ./.github/workflows/lynx-docker.yml@main
with:
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}

0 comments on commit 1fbe9a0

Please sign in to comment.