diff --git a/.github/workflows/lynx-docker.yml b/.github/workflows/lynx-docker.yml index 5732718f05e..2c8e89cf8cd 100644 --- a/.github/workflows/lynx-docker.yml +++ b/.github/workflows/lynx-docker.yml @@ -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: @@ -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 diff --git a/.github/workflows/lynx-label.yml b/.github/workflows/lynx-label.yml index 8524fc3cf0d..ddf22657bdd 100644 --- a/.github/workflows/lynx-label.yml +++ b/.github/workflows/lynx-label.yml @@ -8,22 +8,31 @@ 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: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}