Build and Push Platform Deploy Service #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Platform Deploy Service | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| deploy: | |
| name: "Build and Push" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - name: Set timestamp tag | |
| id: set-tag | |
| run: | | |
| echo "tag=ts-$(date -u +%Y%m%d-%H%M%S)" >> "$GITHUB_OUTPUT" | |
| - name: Log in to GHCR | |
| env: | |
| GHCR_USERNAME: ${{ secrets.GHCR_USER || github.actor }} | |
| GHCR_PASSWORD: ${{ secrets.GHCR_PAT || github.token }} | |
| run: echo "${GHCR_PASSWORD}" | docker login ghcr.io -u "${GHCR_USERNAME}" --password-stdin | |
| - name: Build Platform Deploy Service Docker image | |
| run: | | |
| cd platform-deploy-service/ | |
| docker build \ | |
| -t ghcr.io/${{ github.repository_owner }}/platform-deploy-service:${{ steps.set-tag.outputs.tag }} \ | |
| -t ghcr.io/${{ github.repository_owner }}/platform-deploy-service:latest \ | |
| . | |
| - name: Build Platform App Deploy Runner Docker image | |
| run: | | |
| cd platform-deploy-service/ | |
| docker build \ | |
| -f runner.Dockerfile \ | |
| -t ghcr.io/${{ github.repository_owner }}/platform-app-deploy-runner:${{ steps.set-tag.outputs.tag }} \ | |
| -t ghcr.io/${{ github.repository_owner }}/platform-app-deploy-runner:latest \ | |
| . | |
| - name: Push Platform Deploy Service Docker image to GHCR | |
| run: | | |
| docker push ghcr.io/${{ github.repository_owner }}/platform-deploy-service:${{ steps.set-tag.outputs.tag }} | |
| docker push ghcr.io/${{ github.repository_owner }}/platform-deploy-service:latest | |
| - name: Push Platform App Deploy Runner Docker image to GHCR | |
| run: | | |
| docker push ghcr.io/${{ github.repository_owner }}/platform-app-deploy-runner:${{ steps.set-tag.outputs.tag }} | |
| docker push ghcr.io/${{ github.repository_owner }}/platform-app-deploy-runner:latest | |
| - name: Remove local Docker images | |
| run: | | |
| docker rmi ghcr.io/${{ github.repository_owner }}/platform-deploy-service:${{ steps.set-tag.outputs.tag }} || true | |
| docker rmi ghcr.io/${{ github.repository_owner }}/platform-deploy-service:latest || true | |
| docker rmi ghcr.io/${{ github.repository_owner }}/platform-app-deploy-runner:${{ steps.set-tag.outputs.tag }} || true | |
| docker rmi ghcr.io/${{ github.repository_owner }}/platform-app-deploy-runner:latest || true | |
| docker image prune -f |