docker-nightly-release.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. name: Docker nightly release
  2. on:
  3. workflow_dispatch:
  4. schedule:
  5. - cron: '0 0 * * *'
  6. jobs:
  7. check_date:
  8. runs-on: ubuntu-latest
  9. name: Check latest commit
  10. outputs:
  11. should_run: ${{ steps.should_run.outputs.should_run }}
  12. steps:
  13. - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
  14. - name: print latest_commit
  15. run: echo ${{ github.sha }}
  16. - id: should_run
  17. continue-on-error: true
  18. name: check latest commit is less than a day
  19. if: ${{ github.event_name == 'schedule' }}
  20. run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
  21. ci:
  22. runs-on: ubuntu-latest
  23. needs: check_date
  24. if: ${{ needs.check_date.outputs.should_run != 'false' }}
  25. steps:
  26. - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
  27. - run: corepack enable
  28. - uses: actions/setup-node@v3
  29. with:
  30. node-version: 16
  31. cache: 'pnpm'
  32. - name: Install dependencies
  33. run: pnpm i
  34. - name: Run linters
  35. run: pnpm lint
  36. - name: Run unit test
  37. run: pnpm test
  38. - name: Build the app
  39. run: pnpm build
  40. build:
  41. runs-on: ubuntu-latest
  42. needs:
  43. - ci
  44. steps:
  45. - name: Checkout
  46. uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
  47. - name: Login to GitHub Container Registry
  48. uses: docker/login-action@v2
  49. with:
  50. registry: ghcr.io
  51. username: ${{ github.repository_owner }}
  52. password: ${{ secrets.GITHUB_TOKEN }}
  53. - name: Login to Docker Hub
  54. uses: docker/login-action@v2
  55. with:
  56. username: ${{ secrets.DOCKERHUB_USERNAME }}
  57. password: ${{ secrets.DOCKERHUB_TOKEN }}
  58. - name: Set up QEMU
  59. uses: docker/setup-qemu-action@v2
  60. - name: Set up Docker Buildx
  61. uses: docker/setup-buildx-action@v2
  62. - name: Build and push
  63. uses: docker/build-push-action@v4
  64. with:
  65. context: .
  66. file: ./Dockerfile
  67. platforms: linux/amd64,linux/arm64
  68. push: true
  69. tags: |
  70. corentinth/it-tools:nightly
  71. ghcr.io/corentinth/it-tools:nightly