docker-publish.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. name: Publish Docker images
  2. on:
  3. push:
  4. branches:
  5. - edge
  6. release:
  7. workflow_dispatch:
  8. permissions:
  9. contents: read
  10. # packages: write
  11. jobs:
  12. build-container-image:
  13. name: Build Docker image ${{ matrix.name }}
  14. runs-on: ubuntu-latest
  15. strategy:
  16. matrix:
  17. include:
  18. - name: Debian
  19. file: Docker/Dockerfile
  20. flavor: |
  21. latest=auto
  22. tags: |
  23. type=edge,onlatest=false
  24. type=semver,pattern={{version}}
  25. type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
  26. # type=semver,pattern={{major}}.{{minor}}
  27. - name: Alpine
  28. file: Docker/Dockerfile-Alpine
  29. flavor: |
  30. latest=false
  31. tags: |
  32. type=raw,value=alpine,enable=${{ github.ref == 'refs/heads/latest' || startsWith(github.ref, 'refs/tags/') }}
  33. type=edge,suffix=-alpine,onlatest=false
  34. type=semver,pattern={{version}}-alpine
  35. type=semver,pattern={{major}}-alpine,enable=${{ !startsWith(github.ref, 'refs/tags/0.') }}
  36. # type=semver,pattern={{major}}.{{minor}}-alpine
  37. steps:
  38. - name: Set up QEMU
  39. uses: docker/setup-qemu-action@v3
  40. - name: Set up Docker Buildx
  41. uses: docker/setup-buildx-action@v3
  42. - name: Checkout
  43. uses: actions/checkout@v4
  44. - name: Get FreshRSS version
  45. run: |
  46. FRESHRSS_VERSION=$(sed -n "s/^const FRESHRSS_VERSION = '\(.*\)'.*$/\1/p" constants.php)
  47. echo "$FRESHRSS_VERSION"
  48. echo "FRESHRSS_VERSION=$FRESHRSS_VERSION" >> $GITHUB_ENV
  49. - name: Add metadata to Docker images
  50. id: meta
  51. uses: docker/metadata-action@v5
  52. with:
  53. flavor: ${{ matrix.flavor }}
  54. images: |
  55. docker.io/freshrss/freshrss
  56. # ghcr.io/${{ github.repository }}
  57. tags: ${{ matrix.tags }}
  58. labels: |
  59. org.opencontainers.image.url=https://freshrss.org/
  60. org.opencontainers.image.version=${{ env.FRESHRSS_VERSION }}
  61. - name: Login to Docker Hub
  62. if: github.repository_owner == 'FreshRSS'
  63. uses: docker/login-action@v3
  64. with:
  65. username: ${{ secrets.DOCKERHUB_USERNAME }}
  66. password: ${{ secrets.DOCKERHUB_TOKEN }}
  67. # - name: Login to GitHub Container Registry
  68. # uses: docker/login-action@v3
  69. # with:
  70. # registry: ghcr.io
  71. # username: ${{ github.repository_owner }}
  72. # password: ${{ secrets.GITHUB_TOKEN }}
  73. - name: Build and push Docker images
  74. uses: docker/build-push-action@v6
  75. with:
  76. file: ${{ matrix.file }}
  77. platforms: linux/amd64,linux/arm/v7,linux/arm64
  78. build-args: |
  79. FRESHRSS_VERSION=${{ env.FRESHRSS_VERSION }}
  80. SOURCE_COMMIT=${{ github.sha }}
  81. tags: ${{ steps.meta.outputs.tags }}
  82. labels: ${{ steps.meta.outputs.labels }}
  83. push: ${{ (github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/edge' || startsWith(github.ref, 'refs/tags/')) && github.repository_owner == 'FreshRSS' }}