name: Build and push image on: push: branches: - main workflow_dispatch: env: IMAGE: code.aneur.in/cloud/webfetch-mcpo-docker jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to code.aneur.in registry uses: docker/login-action@v3 with: registry: code.aneur.in username: ${{ gitea.actor }} password: ${{ secrets.BUILD_API_TOKEN }} - name: Promote current "latest" to "previous" run: | if docker buildx imagetools inspect "$IMAGE:latest" >/dev/null 2>&1; then docker buildx imagetools create -t "$IMAGE:previous" "$IMAGE:latest" else echo "No existing :latest to promote; skipping." fi - name: Build and push uses: docker/build-push-action@v5 with: context: . push: true tags: code.aneur.in/${{ gitea.repository }}:latest