companion-deploy.yml 2.2 KB

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