build.yml 2.5 KB

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