name: Build podman-dind-like on: push: branches: - 'release/**' - 'feature/**' - develop tags: - '*' pull_request: branches: - main - 'release/**' - develop env: GITHUB_DOCKER_USER: ${{ github.actor }} NEXUS_DOCKER_USER: ${{ secrets.HOME_NEXUS_DOCKER_USER }} jobs: build-and-push: runs-on: [ self-hosted, big, build ] container: image: quay.io/podman/stable:latest options: --userns=keep-id --group-add keep-groups --privileged --user root strategy: fail-fast: false max-parallel: 2 matrix: registry: [ 'ghcr.io', 'nexus.jamesjonesconsulting.com:5443' ] include: - registry: ghcr.io user: GITHUB_DOCKER_USER password: GITHUB_TOKEN - registry: nexus.jamesjonesconsulting.com:5443 user: NEXUS_DOCKER_USER password: HOME_NEXUS_DOCKER_PASSWORD steps: # Downloads a copy of the code in your repository before running CI tests - name: Check out repository code uses: actions/checkout@v3 - name: Add on podman-docker for step compatibility run: | dnf install -y podman-docker - name: Docker Login uses: azure/docker-login@v1 with: login-server: ${{ matrix.registry }} username: ${{ env[matrix.user] }} password: ${{ secrets[matrix.password] }} # This requires docker buildx which podman doesn't support # - name: Extract metadata (tags, labels) for Docker # id: meta # uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 # with: # images: ${{ matrix.registry }}/${{ env.IMAGE_NAME }} # - name: Build and push Docker images # uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc # with: # context: . # push: true # tags: ${{ steps.meta.outputs.tags }} # labels: ${{ steps.meta.outputs.labels }} - name: Build the Docker image run: | IMAGE_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then VERSION=$GITHUB_REF_NAME else VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's|/|-|g') fi podman build . --file Dockerfile --tag "${{ matrix.registry }}/$IMAGE_NAME:$VERSION" podman push "${{ matrix.registry }}/$IMAGE_NAME:$VERSION" if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then podman tag "${{ matrix.registry }}/$IMAGE_NAME:$VERSION" "${{ matrix.registry }}/$IMAGE_NAME:latest" podman push "${{ matrix.registry }}/$IMAGE_NAME:latest" fi