build.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. name: Build
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - master
  7. paths-ignore:
  8. - '**/*.md'
  9. - '**/*.yml'
  10. - '.gitignore'
  11. - '.dockerignore'
  12. - '.github/**'
  13. - '.github/workflows/**'
  14. concurrency:
  15. group: build
  16. cancel-in-progress: false
  17. jobs:
  18. shellcheck:
  19. name: Test
  20. uses: ./.github/workflows/check.yml
  21. build:
  22. name: Build
  23. needs: shellcheck
  24. runs-on: ubuntu-latest
  25. permissions:
  26. actions: write
  27. packages: write
  28. contents: read
  29. steps:
  30. -
  31. name: Checkout
  32. uses: actions/checkout@v4
  33. with:
  34. fetch-depth: 0
  35. -
  36. name: Docker metadata
  37. id: meta
  38. uses: docker/metadata-action@v5
  39. with:
  40. context: git
  41. images: |
  42. ${{ secrets.DOCKERHUB_REPO }}
  43. ghcr.io/${{ github.repository }}
  44. tags: |
  45. type=raw,value=latest,priority=100
  46. type=raw,value=${{ vars.MAJOR }}.${{ vars.MINOR }}
  47. labels: |
  48. org.opencontainers.image.title=${{ vars.NAME }}
  49. env:
  50. DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
  51. -
  52. name: Set up Docker Buildx
  53. uses: docker/setup-buildx-action@v3
  54. -
  55. name: Login into Docker Hub
  56. uses: docker/login-action@v3
  57. with:
  58. username: ${{ secrets.DOCKERHUB_USERNAME }}
  59. password: ${{ secrets.DOCKERHUB_TOKEN }}
  60. -
  61. name: Login to GitHub Container Registry
  62. uses: docker/login-action@v3
  63. with:
  64. registry: ghcr.io
  65. username: ${{ github.actor }}
  66. password: ${{ secrets.GITHUB_TOKEN }}
  67. -
  68. name: Build Docker image
  69. uses: docker/build-push-action@v5
  70. with:
  71. context: .
  72. push: true
  73. provenance: false
  74. platforms: linux/amd64,linux/arm64,linux/arm
  75. tags: ${{ steps.meta.outputs.tags }}
  76. labels: ${{ steps.meta.outputs.labels }}
  77. annotations: ${{ steps.meta.outputs.annotations }}
  78. build-args: |
  79. VERSION_ARG=${{ steps.meta.outputs.version }}
  80. -
  81. name: Create a release
  82. uses: action-pack/github-release@v2
  83. with:
  84. tag: "v${{ steps.meta.outputs.version }}"
  85. title: "v${{ steps.meta.outputs.version }}"
  86. token: ${{ secrets.REPO_ACCESS_TOKEN }}
  87. -
  88. name: Increment version variable
  89. uses: action-pack/bump@v2
  90. with:
  91. token: ${{ secrets.REPO_ACCESS_TOKEN }}