build-and-release.yml 2.6 KB

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