companion-deploy.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # N.B.: This won't run on releases because of
  2. # https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow.
  3. # However, we also have a companion deploy that's part of the release.yml workflow.
  4. name: Companion Edge Deploy
  5. on:
  6. push:
  7. branches: ['main']
  8. paths:
  9. - yarn.lock
  10. - 'packages/@uppy/companion/**'
  11. - '.github/workflows/companion-deploy.yml'
  12. env:
  13. YARN_ENABLE_GLOBAL_CACHE: false
  14. jobs:
  15. npm:
  16. name: Generate npm tarball
  17. runs-on: ubuntu-latest
  18. steps:
  19. - name: Checkout sources
  20. uses: actions/checkout@v4
  21. - name: Set SHA commit in version
  22. run:
  23. (cd packages/@uppy/companion && node -e 'const
  24. pkg=require("./package.json");pkg.version+="+${{ github.sha
  25. }}";fs.writeFileSync("package.json",JSON.stringify(pkg, undefined,
  26. 2)+"\n")')
  27. - name: Create Companion tarball
  28. run:
  29. corepack yarn workspace @uppy/companion pack --install-if-needed -o
  30. /tmp/companion-${{ github.sha }}.tar.gz
  31. - name: Upload artifact
  32. if: success()
  33. uses: actions/upload-artifact@v4
  34. with:
  35. name: companion-${{ github.sha }}.tar.gz
  36. path: /tmp/companion-${{ github.sha }}.tar.gz
  37. docker:
  38. name: DockerHub
  39. runs-on: ubuntu-latest
  40. env:
  41. DOCKER_BUILDKIT: 0
  42. COMPOSE_DOCKER_CLI_BUILD: 0
  43. steps:
  44. - name: Checkout sources
  45. uses: actions/checkout@v4
  46. - name: Docker meta
  47. id: docker_meta
  48. uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
  49. with:
  50. images: transloadit/companion
  51. tags: |
  52. type=edge
  53. type=raw,value=latest,enable=false
  54. - uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
  55. - uses: docker/setup-buildx-action@v3
  56. - name: Log in to DockerHub
  57. uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
  58. with:
  59. username: ${{secrets.DOCKER_USERNAME}}
  60. password: ${{secrets.DOCKER_PASSWORD}}
  61. - name: Build and push
  62. uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
  63. with:
  64. push: true
  65. context: .
  66. platforms: linux/amd64,linux/arm64
  67. file: Dockerfile
  68. tags: ${{ steps.docker_meta.outputs.tags }}
  69. labels: ${{ steps.docker_meta.outputs.labels }}
  70. heroku:
  71. name: Heroku
  72. runs-on: ubuntu-latest
  73. steps:
  74. - name: Checkout sources
  75. uses: actions/checkout@v4
  76. - name: Alter dockerfile
  77. run: |
  78. sed -i 's/^EXPOSE 3020$/EXPOSE $PORT/g' Dockerfile
  79. - name: Deploy to heroku
  80. uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520 # v3.13.15
  81. with:
  82. heroku_api_key: ${{secrets.HEROKU_API_KEY}}
  83. heroku_app_name: companion-demo
  84. heroku_email: ${{secrets.HEROKU_EMAIL}}
  85. usedocker: true