Use compas docker image to avoid linux installs on ci (#1428) #496
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: Dockerhub Image CI | |
| on: | |
| push: | |
| branches: [ dev ] | |
| workflow_dispatch: null | |
| # Add permissions for the built-in GITHUB_TOKEN | |
| permissions: | |
| contents: read | |
| packages: write | |
| # Ensures only the latest workflow run for the same branch is active, canceling any in-progress runs. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| release: | |
| name: Build Docker image and push to DockerHub | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to Dockerhub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get release version | |
| run: echo "COMPAS_VERSION=$(sed -n '/const std::string VERSION_STRING/,/^$/p' ./src/changelog.h | sed 's/.*"\(.*\)"[^"]*$/\1/')" >> $GITHUB_ENV | |
| - name: Set lowercase repository name | |
| run: echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
| - name: Print version and repo | |
| run: | | |
| echo "Version: $COMPAS_VERSION" | |
| echo "Lowercase repo: $REPO_LC" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| teamcompas/compas:${{ env.COMPAS_VERSION }} | |
| teamcompas/compas:latest | |
| ghcr.io/${{ env.REPO_LC }}:${{ env.COMPAS_VERSION }} | |
| ghcr.io/${{ env.REPO_LC }}:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |