You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

61 rivejä
2.0 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 image prune -af
  23. docker container stop $(docker container ls -aq) || true
  24. docker container rm $(docker container ls -aq) || true
  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/*.img.xz | xargs -n 1 basename)
  31. - name: Fix Permissions
  32. id: fix_perm_filename
  33. run: |
  34. chmod a+rw ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}
  35. echo ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}
  36. - name: Create Release
  37. id: create_release
  38. uses: actions/create-release@v1
  39. env:
  40. GITHUB_TOKEN: ${{ secrets.LONG_TOKEN }}
  41. with:
  42. tag_name: ${{ github.ref }}
  43. release_name: Release ${{ github.ref }}
  44. draft: false
  45. prerelease: false
  46. - name: Upload Release Asset
  47. id: upload-release-asset
  48. uses: actions/upload-release-asset@v1
  49. env:
  50. GITHUB_TOKEN: ${{ secrets.LONG_TOKEN }}
  51. with:
  52. upload_url: ${{ steps.create_release.outputs.upload_url }}
  53. asset_path: ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}
  54. asset_name: ${{ steps.builder.outputs.filename }}
  55. asset_content_type: application/x-tar
  56. - name: Delete Image
  57. id: delete_image
  58. run: |
  59. rm ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}