Skip to content

Commit

Permalink
workflow debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
KPrasch committed Feb 14, 2024
1 parent c0fadbe commit e68ed0b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/lynx-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: '🐳 Publish Lynx to DockerHub'

on:
workflow_call:
inputs:
docker_username:
required: true
type: string
docker_password:
required: true
type: secret
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true

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

- name: Update Development Package Metadata
if: ${{ github.ref_type == 'branch' }}
if: github.ref_type == 'branch'
run: |
pip install bumpversion
export VERSION=$(bumpversion major --dry-run --list --allow-dirty | grep current_version= | sed 's/current_version=//g')
echo "Set development version: $VERSION-dev.${{github.sha}}"
bumpversion devnum --new-version $VERSION-dev.${{github.sha}} --no-tag --no-commit
echo "Set development version: $VERSION-dev.${GITHUB_SHA}"
bumpversion devnum --new-version $VERSION-dev.${GITHUB_SHA} --no-tag --no-commit
- name: Build and push Docker image (development)
if: ${{ github.ref_type == 'branch' }}
if: github.ref_type == 'branch'
uses: docker/build-push-action@v5
with:
context: ${{ github.workspace }}
file: ./deploy/docker/Dockerfile
push: true
tags: nucypher/nucypher:lynx
tags: nucypher/nucypher:lynx-dev-${{ github.sha }}

- name: Build and push Docker image (tag)
if: ${{ github.ref_type == 'tag' }}
if: github.ref_type == 'tag'
uses: docker/build-push-action@v5
with:
context: ${{ github.workspace }}
file: ./deploy/docker/Dockerfile
push: true
tags: |
nucypher/nucypher:${{github.ref_name}}
nucypher/nucypher:${{ github.ref_name }}
nucypher/nucypher:lynx
38 changes: 22 additions & 16 deletions .github/workflows/lynx-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,28 @@ on:
- epic-*

jobs:
lynx-docker:
check-labels:
runs-on: ubuntu-latest
outputs:
has-matching-label: ${{ steps.label-check.outputs.match-found }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: label-check
name: Check for Specific Label
run: |
LABEL_MATCH="Lynx"
MATCH_FOUND="false"
for label in $(echo '${{ toJson(github.event.pull_request.labels.*.name) }}' | jq -r '.[]'); do
echo "label=$label" >> $GITHUB_OUTPUT
if [[ "$label" == "$LABEL_MATCH" ]]; then
MATCH_FOUND="true"
break
fi
done
echo "match-found=$MATCH_FOUND" >> $GITHUB_OUTPUT
env:
GITHUB_OUTPUT: $GITHUB_ENV

- name: Print a message if 'lynx' label is present
if: github.event.pull_request.labels.*.name == 'Lynx 🐳'
run: echo "The 'lynx' label is present. Proceeding with Docker build and push operations."

- name: Print the labels
run: echo "The labels are ${{ github.event.pull_request.labels }}"

- name: Call Docker Workflow if Label is Present
if: github.event.pull_request.labels.*.name == 'Lynx 🐳'
uses: ./.github/workflows/lynx-docker.yml@main
with:
docker_username: ${{ secrets.DOCKER_USERNAME }}
docker_password: ${{ secrets.DOCKER_PASSWORD }}
dispatch:
needs: check-labels
if: needs.check-labels.outputs.has-matching-label == 'true'
uses: ./.github/workflows/lynx-docker.yml

0 comments on commit e68ed0b

Please sign in to comment.