docker.yml.bak 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Docker
  2. on:
  3. push:
  4. tags:
  5. - 'v*'
  6. workflow_dispatch:
  7. jobs:
  8. docker:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Checkout
  12. uses: actions/checkout@v4
  13. - name: Set up Docker Buildx
  14. uses: docker/setup-buildx-action@v3
  15. - name: Login to Docker Hub
  16. if: github.event_name != 'pull_request'
  17. uses: docker/login-action@v3
  18. with:
  19. username: ${{ secrets.DOCKER_USERNAME }}
  20. password: ${{ secrets.DOCKER_PASSWORD }}
  21. - name: Extract metadata
  22. id: meta
  23. uses: docker/metadata-action@v5
  24. with:
  25. images: your-username/swb-sys-monitor
  26. tags: |
  27. type=ref,event=branch
  28. type=ref,event=pr
  29. type=semver,pattern={{version}}
  30. type=semver,pattern={{major}}.{{minor}}
  31. - name: Build and push
  32. uses: docker/build-push-action@v5
  33. with:
  34. context: .
  35. platforms: linux/amd64,linux/arm64
  36. push: ${{ github.event_name != 'pull_request' }}
  37. tags: ${{ steps.meta.outputs.tags }}
  38. labels: ${{ steps.meta.outputs.labels }}
  39. cache-from: type=gha
  40. cache-to: type=gha,mode=max