release_services.yaml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ---
  2. name: release_services
  3. on:
  4. push:
  5. branches:
  6. - main
  7. permissions:
  8. contents: read
  9. packages: write
  10. jobs:
  11. build-image:
  12. strategy:
  13. matrix:
  14. apps:
  15. - name: job_sidecar_container
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Checkout the repo
  19. uses: actions/checkout@v4
  20. - name: Get changed files in the docs folder
  21. id: changed-files-specific
  22. uses: tj-actions/changed-files@v40.2.0
  23. with:
  24. files: services/${{ matrix.apps.name }}/**
  25. - name: Set up QEMU
  26. if: steps.changed-files-specific.outputs.any_changed == 'true'
  27. uses: docker/setup-qemu-action@v3
  28. - name: Set up Docker Buildx
  29. if: steps.changed-files-specific.outputs.any_changed == 'true'
  30. uses: docker/setup-buildx-action@v3
  31. - name: Login to GitHub Package Registry
  32. if: steps.changed-files-specific.outputs.any_changed == 'true'
  33. uses: docker/login-action@v3
  34. with:
  35. registry: ghcr.io
  36. username: ${{github.actor}}
  37. password: ${{ secrets.GITHUB_TOKEN }}
  38. - name: Set Github tag
  39. if: steps.changed-files-specific.outputs.any_changed == 'true'
  40. id: vars
  41. run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
  42. - name: Build and push
  43. if: steps.changed-files-specific.outputs.any_changed == 'true'
  44. uses: docker/build-push-action@v5
  45. env:
  46. DOCKER_BUILDKIT: 1
  47. with:
  48. context: services/${{ matrix.apps.name }}
  49. platforms: linux/amd64,linux/arm64
  50. push: github.ref == 'refs/heads/master'
  51. tags: |
  52. ghcr.io/porter-dev/${{ matrix.apps.name }}:${{ steps.vars.outputs.sha_short }}
  53. ghcr.io/porter-dev/${{ matrix.apps.name }}:latest