-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(build.yml): add Linux package hooks #40
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you want to calculate all digests in one step, but I cannot see
daed-full-src.zip.dgst
. Something goes wrong?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c3abeb8 does not fix up the problem
daed-full-src.zip should not be zipped again
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
daed-full-src.zip
is actually zipped by the Action workflow, and when upload it to Action artifacts, it will be zipped again asdaed-full-src.zip.zip
, so in the last release job, we should only generate the dgst file for it, but not zip it again like web files.