-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(build.yml): add Linux package hooks (#40)
Co-authored-by: Kevin Yu <[email protected]> Co-authored-by: Markson <[email protected]>
- Loading branch information
1 parent
dd6f37f
commit 7c39240
Showing
5 changed files
with
77 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,17 +22,11 @@ jobs: | |
- name: Create full source ZIP archive and Signature | ||
run: | | ||
zip -9vr daed-full-src.zip . -x .git/\* | ||
FILE=./daed-full-src.zip | ||
DGST=$FILE.dgst | ||
md5sum $FILE >>$DGST | ||
shasum -a 1 $FILE >>$DGST | ||
shasum -a 256 $FILE >>$DGST | ||
shasum -a 512 $FILE >>$DGST | ||
- name: Upload artifact - full source | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: daed-full-src | ||
name: daed-full-src.zip | ||
path: daed-full-src.zip | ||
|
||
build-web: | ||
|
@@ -180,24 +174,25 @@ jobs: | |
if: matrix.goarch == 'amd64' && matrix.goamd64 == 'v1' | ||
run: ./bundled/${{ steps.get_filename.outputs.BUNDLE_NAME }} --version | ||
|
||
- name: Create binary ZIP archive and Signature | ||
run: | | ||
pushd bundled || exit 1 | ||
zip -9vr ../${{ steps.get_filename.outputs.BUNDLE_NAME }}.zip . | ||
popd || exit 1 | ||
FILE=./${{ steps.get_filename.outputs.BUNDLE_NAME }}.zip | ||
DGST=$FILE.dgst | ||
md5sum $FILE >>$DGST | ||
shasum -a 1 $FILE >>$DGST | ||
shasum -a 256 $FILE >>$DGST | ||
shasum -a 512 $FILE >>$DGST | ||
- name: Upload artifact - bundle | ||
if: ${{ github.event_name != 'release' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.get_filename.outputs.BUNDLE_NAME }} | ||
path: bundled/* | ||
|
||
- name: Create binary ZIP archive | ||
if: ${{ github.event_name == 'release' }} | ||
run: | | ||
zip -9vr ./${{ steps.get_filename.outputs.BUNDLE_NAME }}.zip ./bundled/* | ||
- name: Upload ZIP archive | ||
if: ${{ github.event_name == 'release' }} | ||
uses: nanoufo/[email protected] | ||
with: | ||
path: | | ||
${{ steps.get_filename.outputs.BUNDLE_NAME }}.zip | ||
- name: Build Linux packages | ||
if: ${{ env.GOARM != '5' && env.GOARM != '6' }} | ||
run: | | ||
|
@@ -210,6 +205,9 @@ jobs: | |
--url 'https://github.com/daeuniverse/daed' --description "daed, A Modern Dashboard For dae." \ | ||
--maintainer "[email protected]" --name daed --license 'MIT AGPL' \ | ||
--package daed-linux-$GOARCH$GOAMD64$GOARM.$package_manager \ | ||
--after-install ../install/package_after_install.sh \ | ||
--before-remove ../install/package_before_remove.sh \ | ||
--after-remove ../install/package_after_remove.sh \ | ||
./geoip.dat=/usr/share/daed/geoip.dat ./geosite.dat=/usr/share/daed/geosite.dat \ | ||
./daed.service=/usr/lib/systemd/system/daed.service \ | ||
./${{ steps.get_filename.outputs.BUNDLE_NAME }}=/usr/bin/daed | ||
|
@@ -218,93 +216,76 @@ jobs: | |
cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.deb installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb | ||
cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.rpm installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm | ||
cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.pacman installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst | ||
ls | grep -E ".deb|.pkg.tar.zst|.rpm" | ||
for package in $(ls | grep -E ".deb|.pkg.tar.zst|.rpm");do | ||
md5sum $package >> $package.dgst | ||
shasum -a 1 $package >> $package.dgst | ||
shasum -a 256 $package >> $package.dgst | ||
shasum -a 512 $package >> $package.dgst | ||
cat $package.dgst | ||
done | ||
fi | ||
- name: Upload artifact - packages | ||
if: ${{ github.event_name != 'release' && env.GOARM != '5' && env.GOARM != '6' }} | ||
- name: Upload Linux packages | ||
if: ${{ env.GOARM != '5' && env.GOARM != '6' }} | ||
uses: nanoufo/[email protected] | ||
with: | ||
path: | | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb.dgst | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm.dgst | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst.dgst | ||
- name: Upload Linux packages to GitHub release | ||
if: ${{ github.event_name == 'release' && env.GOARM != '5' && env.GOARM != '6' }} | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb.dgst | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm.dgst | ||
installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst.dgst | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload artifact - bundle-all | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: bundled-all | ||
path: ${{ steps.get_filename.outputs.BUNDLE_NAME }}.zip | ||
upload-release: | ||
if: github.event_name == 'release' | ||
needs: [full-src, build-bundle] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: daed-full-src | ||
path: release/ | ||
|
||
- uses: actions/download-artifact@v3 | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: bundled-all | ||
path: release/ | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
working-directory: release | ||
- name: Prepare files for upload | ||
run: | | ||
cp release/*/*.deb ./ | ||
cp release/*/*.rpm ./ | ||
cp release/*/*.pkg.tar.zst ./ | ||
cp release/*/*.zip ./ | ||
zip -9vr web.zip release/web | ||
for package in $(ls | grep -E ".deb|.pkg.tar.zst|.rpm|.zip");do | ||
md5sum $package >> $package.dgst | ||
shasum -a 1 $package >> $package.dgst | ||
shasum -a 256 $package >> $package.dgst | ||
shasum -a 512 $package >> $package.dgst | ||
done | ||
- name: Upload Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ github.ref }} | ||
files: | | ||
release/* | ||
*zip | ||
*pkg.tar.zst | ||
*deb | ||
*rpm | ||
*dgst | ||
generate_release_notes: true | ||
|
||
upload-prerelease: | ||
if: github.ref == 'refs/heads/main' | ||
needs: [full-src, build-bundle] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: daed-full-src | ||
path: release/ | ||
|
||
- uses: actions/download-artifact@v3 | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: bundled-all | ||
path: release/ | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
working-directory: release | ||
- name: Prepare files for upload | ||
run: | | ||
cp release/*/*.deb ./ | ||
cp release/*/*.rpm ./ | ||
cp release/*/*.pkg.tar.zst ./ | ||
cp release/*/*.zip ./ | ||
zip -9vr web.zip release/web | ||
for package in $(ls | grep -E ".deb|.pkg.tar.zst|.rpm|.zip");do | ||
md5sum $package >> $package.dgst | ||
shasum -a 1 $package >> $package.dgst | ||
shasum -a 256 $package >> $package.dgst | ||
shasum -a 512 $package >> $package.dgst | ||
done | ||
- name: Delete current release assets | ||
uses: 8Mi-Tech/delete-release-assets-action@main | ||
|
@@ -318,6 +299,10 @@ jobs: | |
with: | ||
tag_name: Prerelease | ||
files: | | ||
release/* | ||
*zip | ||
*pkg.tar.zst | ||
*deb | ||
*rpm | ||
*dgst | ||
prerelease: true | ||
generate_release_notes: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,4 +58,4 @@ jobs: | |
assignees: daebot | ||
team-reviewers: | | ||
daed | ||
draft: false | ||
draft: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
systemctl daemon-reload | ||
|
||
if [ "$(systemctl is-active daed)" == 'active' ]; then | ||
systemctl restart daed.service | ||
echo "Restart daed service, it might take a while." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
systemctl daemon-reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
if [ "$(systemctl is-active daed)" == 'active' ]; then | ||
systemctl stop daed.service | ||
echo "stopped daed service, daed will be removed." | ||
fi |