Merge pull request #127 from ICRS/add_project_pass #81
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: database adapter docker image build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'database_adapter/pyproject.toml' | |
| jobs: | |
| version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| VERSION: ${{ steps.get_version.outputs.VERSION }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install toml | |
| - name: Get version from pyproject.toml file | |
| id: get_version | |
| working-directory: ./database_adapter | |
| run: | | |
| version=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])") | |
| echo "VERSION=${version}" >> $GITHUB_OUTPUT | |
| - name: Set VERSION for next jobs | |
| id: set_version | |
| run: echo "VERSION=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_ENV | |
| docker: | |
| needs: | |
| - version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| icroboticssociety/db-adapter | |
| tags: | | |
| type=raw,value=${{ needs.version.outputs.VERSION }} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha | |
| - | |
| name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - | |
| name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| context: ./database_adapter | |
| tags: ${{ steps.meta.outputs.tags }} | |
| file: ./database_adapter/Dockerfile |