build.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. name: Build
  2. on:
  3. workflow_dispatch:
  4. concurrency:
  5. group: build
  6. cancel-in-progress: false
  7. jobs:
  8. shellcheck:
  9. name: Test
  10. uses: ./.github/workflows/check.yml
  11. build:
  12. name: Build
  13. needs: shellcheck
  14. runs-on: ubuntu-latest
  15. permissions:
  16. actions: write
  17. packages: write
  18. contents: read
  19. steps:
  20. -
  21. name: Checkout
  22. uses: actions/checkout@v5
  23. with:
  24. fetch-depth: 0
  25. -
  26. name: Docker metadata
  27. id: meta
  28. uses: docker/metadata-action@v5
  29. with:
  30. context: git
  31. images: |
  32. ${{ secrets.DOCKERHUB_REPO }}
  33. ghcr.io/${{ github.repository }}
  34. tags: |
  35. type=raw,value=latest,priority=100
  36. type=raw,value=${{ vars.MAJOR }}.${{ vars.MINOR }}
  37. labels: |
  38. org.opencontainers.image.title=${{ vars.NAME }}
  39. env:
  40. DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
  41. -
  42. name: Set up Docker Buildx
  43. uses: docker/setup-buildx-action@v3
  44. -
  45. name: Login into Docker Hub
  46. uses: docker/login-action@v3
  47. with:
  48. username: ${{ secrets.DOCKERHUB_USERNAME }}
  49. password: ${{ secrets.DOCKERHUB_TOKEN }}
  50. -
  51. name: Login to GitHub Container Registry
  52. uses: docker/login-action@v3
  53. with:
  54. registry: ghcr.io
  55. username: ${{ github.actor }}
  56. password: ${{ secrets.GITHUB_TOKEN }}
  57. -
  58. name: Build Docker image
  59. uses: docker/build-push-action@v6
  60. with:
  61. context: .
  62. push: true
  63. provenance: false
  64. platforms: linux/amd64,linux/arm64
  65. tags: ${{ steps.meta.outputs.tags }}
  66. labels: ${{ steps.meta.outputs.labels }}
  67. annotations: ${{ steps.meta.outputs.annotations }}
  68. build-args: |
  69. VERSION_ARG=${{ steps.meta.outputs.version }}
  70. -
  71. name: Create a release
  72. uses: action-pack/github-release@v2
  73. with:
  74. tag: "v${{ steps.meta.outputs.version }}"
  75. title: "v${{ steps.meta.outputs.version }}"
  76. token: ${{ secrets.REPO_ACCESS_TOKEN }}
  77. -
  78. name: Increment version variable
  79. uses: action-pack/bump@v2
  80. with:
  81. token: ${{ secrets.REPO_ACCESS_TOKEN }}
  82. -
  83. name: Push to Gitlab mirror
  84. uses: action-pack/gitlab-sync@v3
  85. with:
  86. url: ${{ secrets.GITLAB_URL }}
  87. token: ${{ secrets.GITLAB_TOKEN }}
  88. username: ${{ secrets.GITLAB_USERNAME }}
  89. -
  90. name: Send mail
  91. uses: action-pack/send-mail@v1
  92. with:
  93. to: ${{secrets.MAILTO}}
  94. from: Github Actions <${{secrets.MAILTO}}>
  95. connection_url: ${{secrets.MAIL_CONNECTION}}
  96. subject: Build of ${{ github.event.repository.name }} v${{ steps.meta.outputs.version }} completed
  97. body: |
  98. The build job of ${{ github.event.repository.name }} v${{ steps.meta.outputs.version }} was completed successfully!
  99. See https://github.com/${{ github.repository }}/actions for more information.