name: build on: push: branches: ["master"] pull_request: branches: ["master"] jobs: docker: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@v4 - name: Log in to the Container registry uses: docker/login-action@v3 with: registry: scm.wyattjmiller.com username: ${{ secrets.GH_ACTION_USERNAME }} password: ${{ secrets.GH_ACTION_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: images: scm.wyattjmiller.com/wymiller/ballbot tags: | type=sha,prefix= type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - name: Build and test Docker image uses: docker/build-push-action@v5 with: context: . target: test push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - name: Build and push production Docker image uses: docker/build-push-action@v5 with: context: . target: production push: ${{ github.event_name != 'pull_request' }} tags: scm.wyattjmiller.com/wymiller/ballbot labels: ${{ steps.meta.outputs.labels }}