release_services.yaml 1.8 KB

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