From 0dfc8f9be0aa3a3d15c78a92b0a154a108421276 Mon Sep 17 00:00:00 2001 From: KPrasch Date: Wed, 14 Feb 2024 14:10:59 +0100 Subject: [PATCH] workflow debugging --- .github/workflows/lynx-docker.yml | 25 +++++++------------- .github/workflows/lynx-label.yml | 39 ++++++++++++++++++------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/lynx-docker.yml b/.github/workflows/lynx-docker.yml index 5732718f05e..02bc73825bb 100644 --- a/.github/workflows/lynx-docker.yml +++ b/.github/workflows/lynx-docker.yml @@ -2,13 +2,6 @@ name: '🐳 Publish Lynx to DockerHub' on: workflow_call: - inputs: - docker_username: - required: true - type: string - docker_password: - required: true - type: secret jobs: docker: @@ -24,33 +17,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 diff --git a/.github/workflows/lynx-label.yml b/.github/workflows/lynx-label.yml index 8524fc3cf0d..a922ba4ff02 100644 --- a/.github/workflows/lynx-label.yml +++ b/.github/workflows/lynx-label.yml @@ -8,22 +8,29 @@ 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 + secrets: inherit