diff --git a/.github/pr_comment.yml b/.github/pr_comment.yml index 40ad4f39..34705602 100644 --- a/.github/pr_comment.yml +++ b/.github/pr_comment.yml @@ -1,17 +1,20 @@ PullRequest: opened: | - Hello @$AUTHOR :wave: + Hello @$AUTHOR :wave: - I'm your friendly neighborhood bot and would like to say thank you for - submitting a pull request to Hyperion! + I'm the Hyperion Project Bot and I want to thank you for + contributing to Hyperion with your pull requests! - So that you and other users can test your changes more quickly, - you can find your workflow artifacts [here](https://github.com/$REPO_FULL_NAME/actions/runs/$RUN_ID). + To help you and other users test your pull requests faster, + I'll create a link for you to your workflow artifacts. - If you make changes to your PR, i create a new link to your workflow artifacts. + :link: https://github.com/$REPO_FULL_NAME/actions/runs/$RUN_ID + + Of course, if you make changes to your PR, I will create a new link. Best regards, - Hyperion-Project + Hyperion Project synchronize: | - [Here](https://github.com/$REPO_FULL_NAME/actions/runs/$RUN_ID) is your new link to your workflow artifacts. - + Hey @$AUTHOR I created a new link to your workflow artifacts: + :link: https://github.com/$REPO_FULL_NAME/actions/runs/$RUN_ID + diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml index 3677fe2b..2bb2b978 100644 --- a/.github/workflows/apt.yml +++ b/.github/workflows/apt.yml @@ -1,10 +1,5 @@ name: Hyperion APT Build -on: - push: - branches: - - '**' - tags: - - '*' +on: [workflow_call] jobs: setup: @@ -53,7 +48,7 @@ jobs: - name: Upload package artifact if: startsWith(github.event.ref, 'refs/tags') - uses: actions/upload-artifact@v2.2.4 + uses: actions/upload-artifact@v2 with: path: deploy retention-days: 1 @@ -99,26 +94,12 @@ jobs: fi done - - name: Upload packages to APT server - uses: SamKirkland/FTP-Deploy-Action@4.0.0 + - name: Upload packages to APT server (DRAFT) + uses: SamKirkland/FTP-Deploy-Action@4.1.0 with: server: apt.hyperion-project.org username: ${{ secrets.APT_USER }} password: ${{ secrets.APT_PASSWORD }} local-dir: "./apt/" - server-dir: "./" - - hyperbian: - name: Update HyperBian Release - if: startsWith(github.event.ref, 'refs/tags') - needs: [setup, build, publish] - runs-on: ubuntu-latest - steps: - # Dispatch event to build new HyperBian image - - name: Dispatch HyperBian build - uses: peter-evans/repository-dispatch@v1 - if: ${{ github.repository_owner == 'hyperion-project'}} - with: - repository: hyperion-project/HyperBian - token: ${{ secrets.HYPERION_BOT_TOKEN }} - event-type: hyperion_push + server-dir: ${{ secrets.APT_DRAFT }} + dangerous-clean-slate: true diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index abfd9782..95ab9fd7 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -1,5 +1,6 @@ name: Clean artifacts +# Run cleanup workflow at the end of every day on: schedule: - cron: '0 0 * * *' diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..1f12528b --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,117 @@ +name: Nightly build + +# Create nightly builds at the end of every day +on: + schedule: + - cron: '0 0 * * *' + +jobs: + setup: + name: Setup nightly build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set APT matrix + id: apt-ppa + run: | + APT=$(echo $(cat .github/workflows/apt.json) | jq --compact-output .) + echo "::set-output name=apt::$APT" + outputs: + apt-matrix: ${{ steps.apt-ppa.outputs.apt }} + + build: + name: ${{ matrix.description }} + needs: [setup] + runs-on: ubuntu-latest + strategy: + matrix: ${{ fromJson(needs.setup.outputs.apt-matrix) }} + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Generate nightly version + id: vars + run: | + VERSION="$(tr -d '\n' < .version)+nightly$(date '+%Y%m%d')$(git rev-parse --short HEAD)" + echo "$VERSION" > .version + + - name: Build package + shell: bash + run: | + mkdir -p "${GITHUB_WORKSPACE}/deploy" + docker run --rm \ + -v "${GITHUB_WORKSPACE}/deploy:/deploy" \ + -v "${GITHUB_WORKSPACE}:/source:rw" \ + ghcr.io/hyperion-project/${{ matrix.architecture }}:$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') \ + /bin/bash -c "cd /source && \ + mkdir -p debian/source && echo '3.0 (quilt)' > debian/source/format && \ + dch --create --distribution $(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') --package 'hyperion' -v '$(cat .version)~$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]')' '${{ github.event.commits[0].message }}' && \ + cp -fr LICENSE debian/copyright && \ + sed 's/@BUILD_DEPENDS@/${{ matrix.build-depends }}/g; s/@DEPENDS@/${{ matrix.package-depends }}/g; s/@ARCHITECTURE@/${{ matrix.architecture }}/g' debian/control.in > debian/control && \ + tar cf ../hyperion_2.0.0.orig.tar . && \ + xz -9 ../hyperion_2.0.0.orig.tar && \ + debuild --no-lintian -uc -us && \ + cp ../hyperion_* /deploy" + + - name: Upload package artifact + uses: actions/upload-artifact@v2.2.4 + with: + path: deploy + retention-days: 1 + + publish: + name: Publish nightly packages + needs: [setup, build] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v3.1.0 + with: + gpg-private-key: ${{ secrets.APT_GPG }} + + - name: Install reprepro + run: sudo apt -y install reprepro + + - name: Make build folders and copy distributions file + run: | + mkdir -p apt/{conf,dists,db} + cp debian/distributions apt/conf/distributions + + - name: Create initial structure/packages files and symbolic links + run: | + reprepro -Vb apt createsymlinks + reprepro -Vb apt export + + - name: Download artifacts + uses: actions/download-artifact@v2.0.10 + + - name: Include artifacts into the package source + run: | + for file in artifact/*.deb; do + if [ -f "$file" ]; then + dist=${file#*~} + dist=${dist%_*} + reprepro -Vb apt/ includedeb "$dist" "$file" + fi + done + + - name: Upload packages to APT server (Nightly) + uses: SamKirkland/FTP-Deploy-Action@4.1.0 + with: + server: apt.hyperion-project.org + username: ${{ secrets.APT_USER }} + password: ${{ secrets.APT_PASSWORD }} + local-dir: "./apt/" + server-dir: ${{ secrets.APT_NIGHTLY }} + dangerous-clean-slate: true + + - name: Remove intermediate artifacts + uses: geekyeggo/delete-artifact@v1 + with: + name: artifact + failOnError: false diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4e3f9fd3..2abb8165 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -199,3 +199,11 @@ jobs: with: name: windows path: windows + +########################## +###### APT workflow ###### +########################## + + apt_build: + name: APT Build + uses: hyperion-project/hyperion.ng/.github/workflows/apt.yml@master diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml index ce46c764..3a5cdbeb 100644 --- a/.github/workflows/push-master.yml +++ b/.github/workflows/push-master.yml @@ -8,9 +8,9 @@ on: jobs: -###################### -###### Linux ######### -###################### +################### +###### Linux ###### +################### Linux: name: ${{ matrix.dockerName }} @@ -37,7 +37,7 @@ jobs: with: submodules: true - # build process + # Build process - name: Build packages env: DOCKER_IMAGE: ${{ matrix.dockerImage }} @@ -47,16 +47,16 @@ jobs: shell: bash run: ./.ci/ci_build.sh - # upload artifacts (only on tagged commit) + # Upload artifacts (only on tagged commit) - name: Upload artifacts if: startsWith(github.event.ref, 'refs/tags') uses: actions/upload-artifact@v2 with: path: deploy/Hyperion-* -###################### -###### macOS ######### -###################### +################### +###### macOS ###### +################### macOS: name: macOS @@ -66,28 +66,28 @@ jobs: with: submodules: true - # install dependencies + # Install dependencies - name: Install dependencies shell: bash run: ./.ci/ci_install.sh - # build process + # Build process - name: Build packages env: PLATFORM: osx shell: bash run: ./.ci/ci_build.sh - # upload artifacts (only on tagged commit) + # Upload artifacts (only on tagged commit) - name: Upload artifacts if: startsWith(github.event.ref, 'refs/tags') uses: actions/upload-artifact@v2 with: path: build/Hyperion-* -###################### -###### Windows ####### -###################### +##################### +###### Windows ###### +##################### windows: name: Windows @@ -149,16 +149,17 @@ jobs: shell: bash run: ./.ci/ci_build.sh - # upload artifacts (only on tagged commit) + # Upload artifacts (only on tagged commit) - name: Upload artifacts if: startsWith(github.event.ref, 'refs/tags') uses: actions/upload-artifact@v2 with: path: build/Hyperion-* + retention-days: 1 -####################################### -###### Publish GitHub Releases ######## -####################################### +##################################### +###### Publish GitHub Releases ###### +##################################### github_publish: name: Publish GitHub Releases @@ -169,7 +170,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # generate environment variables + # Generate environment variables - name: Generate environment variables from .version and tag run: | echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV @@ -187,7 +188,7 @@ jobs: with: path: artifacts - # create draft release and upload artifacts + # Create draft release and upload artifacts - name: Create draft release uses: softprops/action-gh-release@v1 with: @@ -198,3 +199,12 @@ jobs: prerelease: ${{ env.preRelease }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +########################## +###### APT workflow ###### +########################## + + apt_build: + name: APT Build + needs: [Linux, macOS, windows] + uses: hyperion-project/hyperion.ng/.github/workflows/apt.yml@master diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..bf4af932 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,18 @@ +name: Release Actions +on: + release: + types: [published] + +jobs: + hyperbian: + name: Let HyperBian create + runs-on: ubuntu-latest + steps: + # Dispatch event to build new HyperBian image + - name: Dispatch HyperBian build + uses: peter-evans/repository-dispatch@v1.1.3 + if: ${{ github.repository_owner == 'hyperion-project'}} + with: + repository: hyperion-project/HyperBian + token: ${{ secrets.HYPERION_BOT_TOKEN }} + event-type: hyperion_push diff --git a/cmake/package-scripts/prerm b/cmake/package-scripts/prerm index 2f8875d5..151f15b8 100644 --- a/cmake/package-scripts/prerm +++ b/cmake/package-scripts/prerm @@ -27,7 +27,7 @@ then $HYPERION_RUNNING && systemctl stop hyperion hyperiond"@${FOUND_USR}" hyperion"@${FOUND_USR}" "hyperiond@root" "hyperion@root" 2> /dev/null # disable user specific symlink echo "---> Disable service and remove entry" - systemctl -q disable hyperion hyperiond"@${FOUND_USR}" hyperion"@${FOUND_USR}" 2> /dev/null + systemctl -q disable hyperion hyperiond"@${FOUND_USR}" hyperion"@${FOUND_USR}" "hyperiond@root" "hyperion@root" 2> /dev/null rm -v /etc/systemd/system/hyperion.service /etc/systemd/system/hyperiond@.service /etc/systemd/system/hyperion@.service 2> /dev/null elif [ -e /sbin/initctl ]