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.
 
 
 
 
 

51 lines
1.7 KiB

  1. on:
  2. release:
  3. types: [ created ]
  4. name: Build & Deploy Image
  5. jobs:
  6. build:
  7. name: Build & Release Image
  8. runs-on: ARM64
  9. timeout-minutes: 2880
  10. env:
  11. working-directory: ./
  12. steps:
  13. - name: Checkout code
  14. uses: actions/checkout@v2
  15. - name: Clean docker
  16. id: clean_docker
  17. working-directory: ${{ env.working-directory }}
  18. run: |
  19. docker system prune -af
  20. docker system prune --volumes -f
  21. docker image prune -af
  22. docker container stop $(docker container ls -aq) || true
  23. docker container rm $(docker container ls -aq) || true
  24. - name: Build project
  25. id: builder
  26. working-directory: ${{ env.working-directory }}
  27. run: |
  28. bash build-docker.sh
  29. echo ::set-output name=filename::$(ls deploy/*.img.xz | xargs -n 1 basename)
  30. - name: Fix Permissions
  31. id: fix_perm_filename
  32. run: |
  33. chmod a+rw ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}
  34. echo ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}
  35. - name: Upload Release Asset
  36. id: upload-release-asset
  37. uses: actions/upload-release-asset@v1
  38. env:
  39. GITHUB_TOKEN: ${{ secrets.LONG_TOKEN }}
  40. with:
  41. upload_url: ${{ github.event.release.upload_url }}
  42. asset_path: ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}
  43. asset_name: ${{ steps.builder.outputs.filename }}
  44. asset_content_type: application/x-tar
  45. - name: Delete Image
  46. id: delete_image
  47. run: |
  48. rm ${{ env.working-directory }}/deploy/${{ steps.builder.outputs.filename }}