releases.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. name: Release new versions
  2. on:
  3. push:
  4. tags:
  5. - 'v*.*.*'
  6. jobs:
  7. docker-release:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Get release version
  11. run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
  12. - name: Checkout
  13. uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
  14. - name: Login to GitHub Container Registry
  15. uses: docker/login-action@v3
  16. with:
  17. registry: ghcr.io
  18. username: ${{ github.repository_owner }}
  19. password: ${{ secrets.GITHUB_TOKEN }}
  20. - name: Login to Docker Hub
  21. uses: docker/login-action@v3
  22. with:
  23. username: ${{ secrets.DOCKERHUB_USERNAME }}
  24. password: ${{ secrets.DOCKERHUB_TOKEN }}
  25. - name: Set up QEMU
  26. uses: docker/setup-qemu-action@v3
  27. - name: Set up Docker Buildx
  28. uses: docker/setup-buildx-action@v3
  29. - name: Build and push
  30. uses: docker/build-push-action@v5
  31. with:
  32. context: .
  33. file: ./Dockerfile
  34. platforms: linux/amd64,linux/arm64
  35. push: true
  36. tags: |
  37. corentinth/it-tools:latest
  38. corentinth/it-tools:${{ env.RELEASE_VERSION }}
  39. ghcr.io/corentinth/it-tools:latest
  40. ghcr.io/corentinth/it-tools:${{ env.RELEASE_VERSION}}
  41. github-release:
  42. runs-on: ubuntu-latest
  43. needs: docker-release
  44. steps:
  45. - name: Get release version
  46. run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
  47. - name: Checkout
  48. uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
  49. - run: corepack enable
  50. - uses: actions/setup-node@v3
  51. with:
  52. node-version: 20
  53. cache: 'pnpm'
  54. - name: Install dependencies
  55. run: pnpm i
  56. - name: Build the app
  57. run: pnpm build
  58. - name: Zip the app
  59. run: zip -r it-tools-${{ env.RELEASE_VERSION }}.zip dist/*
  60. - name: Get changelog
  61. id: changelog
  62. run: |
  63. EOF=$(openssl rand -hex 8)
  64. echo "changelog<<$EOF" >> $GITHUB_OUTPUT
  65. node ./scripts/getLatestChangelog.mjs >> $GITHUB_OUTPUT
  66. echo "$EOF" >> $GITHUB_OUTPUT
  67. - name: Create Release
  68. uses: softprops/action-gh-release@v1
  69. with:
  70. token: ${{ secrets.GITHUB_TOKEN }}
  71. files: it-tools-${{ env.RELEASE_VERSION }}.zip
  72. tag_name: v${{ env.RELEASE_VERSION }}
  73. draft: true
  74. prerelease: false
  75. body: |
  76. ## Docker images
  77. - Docker Hub
  78. - `corentinth/it-tools:latest`
  79. - `corentinth/it-tools:${{ env.RELEASE_VERSION }}`
  80. - GitHub Container Registry
  81. - `ghcr.io/corentinth/it-tools:latest`
  82. - `ghcr.io/corentinth/it-tools:${{ env.RELEASE_VERSION}}`
  83. ## Changelog
  84. ${{ steps.changelog.outputs.changelog }}