docker-image-amd64-en.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: Publish Docker image (amd64, English)
  2. on:
  3. push:
  4. tags:
  5. - '*'
  6. workflow_dispatch:
  7. inputs:
  8. name:
  9. description: 'reason'
  10. required: false
  11. jobs:
  12. push_to_registries:
  13. name: Push Docker image to multiple registries
  14. runs-on: ubuntu-latest
  15. permissions:
  16. packages: write
  17. contents: read
  18. steps:
  19. - name: Check out the repo
  20. uses: actions/checkout@v3
  21. - name: Save version info
  22. run: |
  23. git describe --tags > VERSION
  24. - name: Translate
  25. run: |
  26. python ./i18n/translate.py --repository_path . --json_file_path ./i18n/en.json
  27. - name: Log in to Docker Hub
  28. uses: docker/login-action@v2
  29. with:
  30. username: ${{ secrets.DOCKERHUB_USERNAME }}
  31. password: ${{ secrets.DOCKERHUB_TOKEN }}
  32. - name: Log in to the Container registry
  33. uses: docker/login-action@v2
  34. with:
  35. registry: ghcr.io
  36. username: ${{ github.actor }}
  37. password: ${{ secrets.GITHUB_TOKEN }}
  38. - name: Extract metadata (tags, labels) for Docker
  39. id: meta
  40. uses: docker/metadata-action@v4
  41. with:
  42. images: |
  43. justsong/one-api-en
  44. ghcr.io/one-api-en
  45. - name: Build and push Docker images
  46. uses: docker/build-push-action@v3
  47. with:
  48. context: .
  49. push: true
  50. tags: ${{ steps.meta.outputs.tags }}
  51. labels: ${{ steps.meta.outputs.labels }}