您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

56 行
1.8 KiB

  1. on:
  2. push:
  3. tags:
  4. - 'v*'
  5. name: Build & Deploy Image
  6. jobs:
  7. build:
  8. name: Build & Release Image
  9. runs-on: self-hosted
  10. timeout-minutes: 2880
  11. env:
  12. working-directory: ./builder
  13. steps:
  14. - name: Checkout code
  15. uses: actions/checkout@v2
  16. - name: Clean docker
  17. id: clean_docker
  18. working-directory: ${{ env.working-directory }}
  19. run: |
  20. docker system prune -af
  21. docker system prune --volumes -f
  22. docker container stop $(docker container ls -aq)
  23. docker container rm $(docker container ls -aq)
  24. docker image prune -af
  25. - name: Build project
  26. id: builder
  27. working-directory: ${{ env.working-directory }}
  28. run: |
  29. bash build-docker.sh
  30. echo ::set-output name=filename::$(ls deploy/*.tar.xz | xargs -n 1 basename)
  31. - name: Create Release
  32. id: create_release
  33. uses: actions/create-release@v1
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.LONG_TOKEN }}
  36. with:
  37. tag_name: ${{ github.ref }}
  38. release_name: Release ${{ github.ref }}
  39. draft: false
  40. prerelease: false
  41. - name: Upload Release Asset
  42. id: upload-release-asset
  43. uses: actions/upload-release-asset@v1
  44. env:
  45. GITHUB_TOKEN: ${{ secrets.LONG_TOKEN }}
  46. with:
  47. upload_url: ${{ steps.create_release.outputs.upload_url }}
  48. asset_path: ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}
  49. asset_name: ${{ steps.builder.outputs.filename }}
  50. asset_content_type: application/x-tar
  51. - name: Delete Image
  52. id: delete_image
  53. run: |
  54. rm ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}