build-and-release.yml 2.6 KB

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