docker-publish.yml 3.1 KB

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