Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
TristenHarr committed Jul 15, 2024
1 parent 937a56d commit 004aa8e
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions .github/workflows/ndc-python-lambda-connector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,53 +36,47 @@ jobs:
echo "pytest not found, skipping tests"
fi
docker:
name: Build base docker image
build-and-push-docker:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: docker-metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
- uses: docker/build-push-action@v5
with:
context: .
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.docker-metadata.outputs.tags }}
labels: ${{ steps.docker-metadata.outputs.labels }}
- name: Build with Makefile
run: make build
- name: Push Docker image
if: startsWith(github.ref, 'refs/tags/v')
run: |
docker push ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${GITHUB_REF#refs/tags/}
docker push ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:latest
release-connector:
name: Release connector
runs-on: ubuntu-latest
needs:
- build-and-test
- docker
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
- build-and-push-docker
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Build connector definition
run: |
if [ -f Makefile ]; then
make build
else
echo "Makefile not found, skipping build"
fi
run: make build
- uses: actions/upload-artifact@v4
with:
name: connector-definition.tgz
path: ./dist/connector-definition.tgz
compression-level: 0 # Already compressed
if: ${{ success() }}
- name: Get version from tag
id: get-version
run: |
Expand Down

0 comments on commit 004aa8e

Please sign in to comment.