diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e37cd5e..78653d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,4 +38,22 @@ jobs: REPO_OWNER: "Local-Connectivity-Lab" REPO_NAME: "ccn-coverage-docker" TARGET_ARTIFACT_NAME: "ccn-coverage-api" - run: npx semantic-release \ No newline at end of file + run: npx semantic-release + + - name: Get version + id: get_version + run: | + VERSION=$(node -p "require('./package.json').version") + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Released version: $VERSION" + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: icr.infra.seattlecommunitynetwork.org + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build and publish Docker image + run: | + make publish VERSION=${{ steps.get_version.outputs.VERSION }} \ No newline at end of file diff --git a/Makefile b/Makefile index da6bb5e..3e37219 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,17 @@ build-%: validate-semver-% @echo "Create docker container for $(API_DOCKER_IMAGE_NAME) with version $*" docker build -t $(API_DOCKER_IMAGE_NAME):$* . +# Publish to Docker registry (e.g., make publish VERSION=1.2.3) +.PHONY: publish +publish: validate-semver-$(VERSION) + @echo "Building and publishing $(API_DOCKER_IMAGE_NAME):$(VERSION)" + docker build -t $(API_DOCKER_IMAGE_NAME):$(VERSION) . + docker tag $(API_DOCKER_IMAGE_NAME):$(VERSION) icr.infra.seattlecommunitynetwork.org/$(API_DOCKER_IMAGE_NAME):$(VERSION) + docker tag $(API_DOCKER_IMAGE_NAME):$(VERSION) icr.infra.seattlecommunitynetwork.org/$(API_DOCKER_IMAGE_NAME):latest + docker push icr.infra.seattlecommunitynetwork.org/$(API_DOCKER_IMAGE_NAME):$(VERSION) + docker push icr.infra.seattlecommunitynetwork.org/$(API_DOCKER_IMAGE_NAME):latest + @echo "Successfully published $(API_DOCKER_IMAGE_NAME):$(VERSION) to registry" + # The target for development .PHONY: dev dev: