Updated pipeline to include k8s branch and change node variable in pr… #1
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: CI to Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| - "k8s" | |
| workflow_dispatch: | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Get Commit Hash | |
| id: vars | |
| run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: Determine Image Tag | |
| run: | | |
| if [[ "${{ github.ref_name }}" == "main" ]]; then | |
| echo "IMAGE_TAG=actions-latest" >> $GITHUB_ENV | |
| elif [[ "${{ github.ref_name }}" == "k8s" ]]; then | |
| echo "IMAGE_TAG=k8s-latest" >> $GITHUB_ENV | |
| fi | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and Push Image | |
| run: | | |
| echo "Building and pushing Docker image for $IMAGE_TAG..." | |
| docker build -t opacitylabs/opacity-simple-prover:$IMAGE_TAG -f Dockerfile . | |
| docker push opacitylabs/opacity-simple-prover:$IMAGE_TAG | |