Changed workflow process

Added nightly build workflow for APT
Debian prerm script corrected
This commit is contained in:
Markus 2021-10-08 20:29:58 +00:00 committed by GitHub
parent 4db8afda87
commit 788e843846
8 changed files with 193 additions and 55 deletions

View File

@ -1,17 +1,20 @@
PullRequest: PullRequest:
opened: | opened: |
Hello @$AUTHOR :wave: Hello @$AUTHOR :wave:
I'm your friendly neighborhood bot and would like to say thank you for I'm the Hyperion Project Bot and I want to thank you for
submitting a pull request to Hyperion! contributing to Hyperion with your pull requests!
So that you and other users can test your changes more quickly, To help you and other users test your pull requests faster,
you can find your workflow artifacts [here](https://github.com/$REPO_FULL_NAME/actions/runs/$RUN_ID). 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, Best regards,
Hyperion-Project Hyperion Project
synchronize: | 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

View File

@ -1,10 +1,5 @@
name: Hyperion APT Build name: Hyperion APT Build
on: on: [workflow_call]
push:
branches:
- '**'
tags:
- '*'
jobs: jobs:
setup: setup:
@ -53,7 +48,7 @@ jobs:
- name: Upload package artifact - name: Upload package artifact
if: startsWith(github.event.ref, 'refs/tags') if: startsWith(github.event.ref, 'refs/tags')
uses: actions/upload-artifact@v2.2.4 uses: actions/upload-artifact@v2
with: with:
path: deploy path: deploy
retention-days: 1 retention-days: 1
@ -99,26 +94,12 @@ jobs:
fi fi
done done
- name: Upload packages to APT server - name: Upload packages to APT server (DRAFT)
uses: SamKirkland/FTP-Deploy-Action@4.0.0 uses: SamKirkland/FTP-Deploy-Action@4.1.0
with: with:
server: apt.hyperion-project.org server: apt.hyperion-project.org
username: ${{ secrets.APT_USER }} username: ${{ secrets.APT_USER }}
password: ${{ secrets.APT_PASSWORD }} password: ${{ secrets.APT_PASSWORD }}
local-dir: "./apt/" local-dir: "./apt/"
server-dir: "./" server-dir: ${{ secrets.APT_DRAFT }}
dangerous-clean-slate: true
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

View File

@ -1,5 +1,6 @@
name: Clean artifacts name: Clean artifacts
# Run cleanup workflow at the end of every day
on: on:
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'

117
.github/workflows/nightly.yml vendored Normal file
View File

@ -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

View File

@ -199,3 +199,11 @@ jobs:
with: with:
name: windows name: windows
path: windows path: windows
##########################
###### APT workflow ######
##########################
apt_build:
name: APT Build
uses: hyperion-project/hyperion.ng/.github/workflows/apt.yml@master

View File

@ -8,9 +8,9 @@ on:
jobs: jobs:
###################### ###################
###### Linux ######### ###### Linux ######
###################### ###################
Linux: Linux:
name: ${{ matrix.dockerName }} name: ${{ matrix.dockerName }}
@ -37,7 +37,7 @@ jobs:
with: with:
submodules: true submodules: true
# build process # Build process
- name: Build packages - name: Build packages
env: env:
DOCKER_IMAGE: ${{ matrix.dockerImage }} DOCKER_IMAGE: ${{ matrix.dockerImage }}
@ -47,16 +47,16 @@ jobs:
shell: bash shell: bash
run: ./.ci/ci_build.sh run: ./.ci/ci_build.sh
# upload artifacts (only on tagged commit) # Upload artifacts (only on tagged commit)
- name: Upload artifacts - name: Upload artifacts
if: startsWith(github.event.ref, 'refs/tags') if: startsWith(github.event.ref, 'refs/tags')
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
path: deploy/Hyperion-* path: deploy/Hyperion-*
###################### ###################
###### macOS ######### ###### macOS ######
###################### ###################
macOS: macOS:
name: macOS name: macOS
@ -66,28 +66,28 @@ jobs:
with: with:
submodules: true submodules: true
# install dependencies # Install dependencies
- name: Install dependencies - name: Install dependencies
shell: bash shell: bash
run: ./.ci/ci_install.sh run: ./.ci/ci_install.sh
# build process # Build process
- name: Build packages - name: Build packages
env: env:
PLATFORM: osx PLATFORM: osx
shell: bash shell: bash
run: ./.ci/ci_build.sh run: ./.ci/ci_build.sh
# upload artifacts (only on tagged commit) # Upload artifacts (only on tagged commit)
- name: Upload artifacts - name: Upload artifacts
if: startsWith(github.event.ref, 'refs/tags') if: startsWith(github.event.ref, 'refs/tags')
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
path: build/Hyperion-* path: build/Hyperion-*
###################### #####################
###### Windows ####### ###### Windows ######
###################### #####################
windows: windows:
name: Windows name: Windows
@ -149,16 +149,17 @@ jobs:
shell: bash shell: bash
run: ./.ci/ci_build.sh run: ./.ci/ci_build.sh
# upload artifacts (only on tagged commit) # Upload artifacts (only on tagged commit)
- name: Upload artifacts - name: Upload artifacts
if: startsWith(github.event.ref, 'refs/tags') if: startsWith(github.event.ref, 'refs/tags')
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
path: build/Hyperion-* path: build/Hyperion-*
retention-days: 1
####################################### #####################################
###### Publish GitHub Releases ######## ###### Publish GitHub Releases ######
####################################### #####################################
github_publish: github_publish:
name: Publish GitHub Releases name: Publish GitHub Releases
@ -169,7 +170,7 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
# generate environment variables # Generate environment variables
- name: Generate environment variables from .version and tag - name: Generate environment variables from .version and tag
run: | run: |
echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
@ -187,7 +188,7 @@ jobs:
with: with:
path: artifacts path: artifacts
# create draft release and upload artifacts # Create draft release and upload artifacts
- name: Create draft release - name: Create draft release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
@ -198,3 +199,12 @@ jobs:
prerelease: ${{ env.preRelease }} prerelease: ${{ env.preRelease }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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

18
.github/workflows/release.yml vendored Normal file
View File

@ -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

View File

@ -27,7 +27,7 @@ then
$HYPERION_RUNNING && systemctl stop hyperion hyperiond"@${FOUND_USR}" hyperion"@${FOUND_USR}" "hyperiond@root" "hyperion@root" 2> /dev/null $HYPERION_RUNNING && systemctl stop hyperion hyperiond"@${FOUND_USR}" hyperion"@${FOUND_USR}" "hyperiond@root" "hyperion@root" 2> /dev/null
# disable user specific symlink # disable user specific symlink
echo "---> Disable service and remove entry" 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 rm -v /etc/systemd/system/hyperion.service /etc/systemd/system/hyperiond@.service /etc/systemd/system/hyperion@.service 2> /dev/null
elif [ -e /sbin/initctl ] elif [ -e /sbin/initctl ]