name: Docker Build and Push with Version on: push: branches: - master env: DOCKER_REGISTRY: r.regnault.dev DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} PORTAINER_API_WEBHOOK: ${{ secrets.PORTAINER_API_WEBHOOK }} jobs: build_and_push: runs-on: docker steps: - name: Checkout repository uses: https://github.com/actions/checkout@v2 - name: Login to GitHub Container Registry uses: https://github.com/docker/login-action@v2 with: registry: ${{ env.DOCKER_REGISTRY }} username: ${{ env.DOCKER_USERNAME }} password: ${{ env.DOCKER_PASSWORD }} - name: Setup docker uses: https://github.com/papodaca/install-docker-action@main - name: Install Rust ToolChain uses: https://github.com/actions-rs/toolchain@v1 with: toolchain: stable - name: Install cargo-semver uses: https://github.com/actions-rs/install@v0.1.2 with: crate: cargo-get version: latest - name: Semver run: echo "VERSION=$(cargo get package.version --pretty)" >> $GITHUB_ENV - name: Set up Docker Buildx uses: https://github.com/docker/setup-buildx-action@v2 - name: Build and push uses: https://github.com/docker/build-push-action@v4 with: context: . push: true tags: | ${{ env.DOCKER_REGISTRY }}/captchuccino:latest ${{ env.DOCKER_REGISTRY }}/captchuccino:${{ env.VERSION }} cache-from: type=gha cache-to: type=gha,mode=max