選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

87 行
3.1KB

  1. name: Docker
  2. on: [push, pull_request]
  3. env:
  4. # Use docker.io for Docker Hub if empty
  5. REGISTRY: docker.io
  6. IMAGE_NAME: zlmediakit/zlmediakit
  7. jobs:
  8. build:
  9. runs-on: ubuntu-latest
  10. permissions:
  11. contents: read
  12. packages: write
  13. # This is used to complete the identity challenge
  14. # with sigstore/fulcio when running outside of PRs.
  15. id-token: write
  16. steps:
  17. - name: Checkout repository
  18. uses: actions/checkout@v3
  19. - name: 下载submodule源码
  20. run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
  21. # Install the cosign tool except on PR
  22. # https://github.com/sigstore/cosign-installer
  23. - name: Install cosign
  24. if: github.event_name != 'pull_request'
  25. uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605
  26. with:
  27. cosign-release: 'v1.7.1'
  28. - name: Set up QEMU
  29. uses: docker/setup-qemu-action@v2
  30. # Workaround: https://github.com/docker/build-push-action/issues/461
  31. - name: Setup Docker buildx
  32. uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
  33. # Login against a Docker registry except on PR
  34. # https://github.com/docker/login-action
  35. - name: Log into registry ${{ env.REGISTRY }}
  36. if: github.event_name != 'pull_request'
  37. uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
  38. with:
  39. registry: ${{ env.REGISTRY }}
  40. username: zlmediakit
  41. password: ${{ secrets.DOCKER_IO_SECRET }}
  42. # Extract metadata (tags, labels) for Docker
  43. # https://github.com/docker/metadata-action
  44. - name: Extract Docker metadata
  45. id: meta
  46. uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
  47. with:
  48. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  49. # Build and push Docker image with Buildx (don't push on PR)
  50. # https://github.com/docker/build-push-action
  51. - name: Build and push Docker image
  52. id: build-and-push
  53. uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
  54. with:
  55. context: .
  56. push: ${{ github.event_name != 'pull_request' }}
  57. tags: ${{ steps.meta.outputs.tags }}
  58. labels: ${{ steps.meta.outputs.labels }}
  59. build-args: MODEL=Release
  60. platforms: linux/amd64,linux/arm64
  61. # Sign the resulting Docker image digest except on PRs.
  62. # This will only write to the public Rekor transparency log when the Docker
  63. # repository is public to avoid leaking data. If you would like to publish
  64. # transparency data even for private images, pass --force to cosign below.
  65. # https://github.com/sigstore/cosign
  66. # - name: Sign the published Docker image
  67. # if: ${{ github.event_name != 'pull_request' }}
  68. # env:
  69. # COSIGN_EXPERIMENTAL: "true"
  70. # # This step uses the identity token to provision an ephemeral certificate
  71. # # against the sigstore community Fulcio instance.
  72. # run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }}