docker-publish.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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@v4
  41. - name: Set up Docker Buildx
  42. uses: docker/setup-buildx-action@v3
  43. - name: Checkout
  44. uses: actions/checkout@v6
  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@v4
  65. with:
  66. username: ${{ secrets.DOCKERHUB_USERNAME }}
  67. password: ${{ secrets.DOCKERHUB_TOKEN }}
  68. - name: Login to GitHub Container Registry
  69. if: github.repository_owner == 'FreshRSS'
  70. uses: docker/login-action@v4
  71. with:
  72. registry: ghcr.io
  73. username: ${{ github.repository_owner }}
  74. password: ${{ secrets.GITHUB_TOKEN }}
  75. - name: Build and push Docker images
  76. uses: docker/build-push-action@v7
  77. with:
  78. file: ${{ matrix.file }}
  79. platforms: linux/amd64,linux/arm/v7,linux/arm64
  80. build-args: |
  81. FRESHRSS_VERSION=${{ env.FRESHRSS_VERSION }}
  82. SOURCE_COMMIT=${{ github.sha }}
  83. tags: ${{ steps.meta.outputs.tags }}
  84. labels: ${{ steps.meta.outputs.labels }}
  85. push: ${{ (github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/edge' || startsWith(github.ref, 'refs/tags/')) && github.repository_owner == 'FreshRSS' }}