companion-deploy.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. jobs:
  13. npm:
  14. name: Generate npm tarball
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Checkout sources
  18. uses: actions/checkout@v3
  19. - name: Set SHA commit in version
  20. run: (cd packages/@uppy/companion && node -e 'const pkg=require("./package.json");pkg.version+="+${{ github.sha }}";fs.writeFileSync("package.json",JSON.stringify(pkg, undefined, 2)+"\n")')
  21. - name: Create Companion tarball
  22. run: corepack yarn workspace @uppy/companion pack --install-if-needed -o /tmp/companion-${{ github.sha }}.tar.gz
  23. - name: Upload artifact
  24. if: success()
  25. uses: actions/upload-artifact@v3
  26. with:
  27. name: companion-${{ github.sha }}.tar.gz
  28. path: /tmp/companion-${{ github.sha }}.tar.gz
  29. docker:
  30. name: DockerHub
  31. runs-on: ubuntu-latest
  32. env:
  33. DOCKER_BUILDKIT: 0
  34. COMPOSE_DOCKER_CLI_BUILD: 0
  35. steps:
  36. - name: Checkout sources
  37. uses: actions/checkout@v3
  38. - name: Docker meta
  39. id: docker_meta
  40. uses: docker/metadata-action@v4
  41. with:
  42. images: transloadit/companion
  43. tags: |
  44. type=edge
  45. type=raw,value=latest,enable=false
  46. - uses: docker/setup-qemu-action@v2
  47. - uses: docker/setup-buildx-action@v2
  48. - name: Log in to DockerHub
  49. uses: docker/login-action@v2
  50. with:
  51. username: ${{secrets.DOCKER_USERNAME}}
  52. password: ${{secrets.DOCKER_PASSWORD}}
  53. - name: Build and push
  54. uses: docker/build-push-action@v3
  55. with:
  56. push: true
  57. context: .
  58. platforms: linux/amd64,linux/arm64
  59. file: Dockerfile
  60. tags: ${{ steps.docker_meta.outputs.tags }}
  61. labels: ${{ steps.docker_meta.outputs.labels }}