combined docker build and colcon build #1
Workflow file for this run
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: docker-build-and-push | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - pathing_and_workflows | |
| jobs: | |
| docker-build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: login | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./src | |
| file: ./src/Containerfile | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKERHUB_USERNAME }}/kestrel:latest | |
| ${{ secrets.DOCKERHUB_USERNAME }}/kestrel:${{ github.sha }} | |
| colcon-build: | |
| needs: docker-build-and-push | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Pull latest image | |
| run: docker pull ${{ secrets.DOCKERHUB_USERNAME }}/kestrel:latest | |
| - name: Colcon build stage | |
| run: | | |
| docker run --rm \ | |
| -v ${{ github.workspace }}:/workspace \ | |
| -w /workspace \ | |
| ${{ secrets.DOCKERHUB_USERNAME }}/kestrel:latest \ | |
| bash -c "cd src && colcon build" |