build-and-release.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. ---
  2. name: "Build & Release pipeline"
  3. on:
  4. pull_request:
  5. workflow_dispatch:
  6. push:
  7. tags:
  8. - '*'
  9. branches:
  10. - main
  11. - next
  12. - beta
  13. jobs:
  14. build:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Checkout
  18. uses: actions/checkout@v6
  19. with:
  20. fetch-depth: 0
  21. - name: Set up QEMU
  22. id: qemu
  23. uses: docker/setup-qemu-action@v4
  24. with:
  25. image: tonistiigi/binfmt:latest
  26. platforms: arm64,arm
  27. - name: Setup node (npm cache)
  28. if: github.event_name != 'pull_request'
  29. uses: actions/setup-node@v6.4.0
  30. with:
  31. cache: 'npm'
  32. cache-dependency-path: frontend/package-lock.json
  33. - name: Setup node
  34. if: github.event_name == 'pull_request'
  35. uses: actions/setup-node@v6.4.0
  36. - name: Setup Go
  37. uses: actions/setup-go@v6
  38. with:
  39. go-version-file: 'service/go.mod'
  40. cache: true
  41. cache-dependency-path: 'service/go.mod'
  42. - name: Print go version
  43. run: go version
  44. - name: Login to Docker Hub
  45. uses: docker/login-action@v4
  46. with:
  47. username: ${{ secrets.DOCKERHUB_USERNAME }}
  48. password: ${{ secrets.DOCKERHUB_KEY }}
  49. - name: Login to ghcr
  50. uses: docker/login-action@v3
  51. with:
  52. registry: ghcr.io
  53. username: ${{ github.actor }}
  54. password: ${{ secrets.CONTAINER_TOKEN }}
  55. - name: get date
  56. run: |
  57. echo "DATE=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
  58. - name: make webui
  59. run: make -w webui-dist
  60. - name: unit tests
  61. run: make -w service-unittests
  62. - name: build service
  63. run: make -w service
  64. - name: integration tests
  65. run: cd integration-tests && make -w
  66. - name: Archive integration tests
  67. uses: actions/upload-artifact@v7
  68. if: always()
  69. with:
  70. name: "OliveTin-integration-tests-${{ env.DATE }}-${{ github.sha }}"
  71. path: |
  72. integration-tests
  73. !integration-tests/node_modules
  74. - name: Install goreleaser
  75. uses: goreleaser/goreleaser-action@v6
  76. with:
  77. install-only: true
  78. - name: Set up Docker Buildx
  79. uses: docker/setup-buildx-action@v3
  80. - name: release
  81. if: github.ref_type != 'tag'
  82. uses: cycjimmy/semantic-release-action@v4
  83. with:
  84. extra_plugins: |
  85. @semantic-release/commit-analyzer
  86. @semantic-release/exec
  87. @semantic-release/git
  88. env:
  89. GITHUB_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
  90. GH_TOKEN: ${{ secrets.CONTAINER_TOKEN }}
  91. - name: Archive binaries
  92. uses: actions/upload-artifact@v4.3.1
  93. with:
  94. name: "OliveTin-snapshot-${{ env.DATE }}-${{ github.sha }}"
  95. path: dist/OliveTin*.*