From 551a6d8ecb418463a7bd0f4964c844cf165e791a Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 2 Mar 2021 10:36:07 +0000 Subject: [PATCH 01/20] Update package, do CI builds (#1) --- .github/workflows/build-on-all-commits.yml | 72 +++++++++++++++++++++ README.md | 2 +- debian/changelog | 9 +++ debian/compat | 1 - debian/control | 9 ++- raspi2png | Bin 13880 -> 0 bytes 6 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build-on-all-commits.yml delete mode 100644 debian/compat delete mode 100755 raspi2png diff --git a/.github/workflows/build-on-all-commits.yml b/.github/workflows/build-on-all-commits.yml new file mode 100644 index 0000000..3d88b61 --- /dev/null +++ b/.github/workflows/build-on-all-commits.yml @@ -0,0 +1,72 @@ +name: Build Package on All Commits + +# Don't run on branches intended for CI modifications +on: + push: + branches-ignore: + - "ci-test-*" + +jobs: + build-debian-package: + runs-on: ubuntu-20.04 + steps: + - name: GitHub Environment Variables Action + uses: FranzDiebold/github-env-vars-action@v1.2.1 + + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Set up Debian Docker container for changelog patching + run: | + docker create --name chglog --volume ${{ github.workspace }}:${{ github.workspace }} --workdir ${{ github.workspace }}/ --tty pitop/gbp-dch-gen:latest sleep inf + docker start chglog + docker exec chglog git config --global user.name "pi-top" + docker exec chglog git config --global user.email "deb-maintainers@pi-top.com" + + - name: Patch changelog (snapshot) + run: | + tag=$(git tag -l v* | sort -V | tail -n1) + commit=$(git show-ref -s ${tag}) + commit_diff=$(git rev-list --count ${commit}..HEAD) + + docker exec chglog gbp dch --verbose --git-author --ignore-branch --snapshot \ + --since=${commit} --snapshot-number=${commit_diff} + + - name: Show updated changelog + run: | + cat debian/changelog + + - name: Build Debian package + uses: pi-top/action-debian-package@v0.2.2 + with: + target_architecture: "armhf" + + source_directory: "${{ github.workspace }}" + artifacts_directory: "${{ github.workspace }}/artifacts/bin" + + docker_image: "pitop/deb-build:latest" + distribution: "buster-backports" + + lintian_opts: "--dont-check-part nmu --no-tag-display-limit --display-info --show-overrides --fail-on error --fail-on warning --fail-on info" + # Package uses latest packaging syntax and Lintian opts/tags + dpkg_buildpackage_opts: "--no-sign --no-check-builddeps --post-clean" + + - name: Separate Debian source package files from binary + run: | + mkdir -p ${{ github.workspace }}/artifacts/src/ + mv ${{ github.workspace }}/artifacts/bin/* ${{ github.workspace }}/artifacts/src/ + mv ${{ github.workspace }}/artifacts/src/*.deb ${{ github.workspace }}/artifacts/bin/ + + - name: Upload Debian source package files + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" + path: "${{ github.workspace }}/artifacts/src/" + + - name: Upload Debian binary packages + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" + path: "${{ github.workspace }}/artifacts/bin/" diff --git a/README.md b/README.md index 8231a45..dbb2a8c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # raspi2png -Utility to take a snapshot of the raspberry pi screen and save it as a PNG file +Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG file Usage: raspi2png [--pngname name] [--width ] [--height ] [--compression ] [--delay ] [--display ] [--stdout] [--help] diff --git a/debian/changelog b/debian/changelog index 7ee3e78..7bcbf70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +raspi2png (0.1-1+nmu1) unstable; urgency=low + + * Non-maintainer upload. + * compat level 12 + * libpng12-dev --> libpng-dev + * Architecture: armhf arm64 + + -- Mike Roberts Tue, 02 Mar 2021 10:26:40 +0000 + raspi2png (0.1-1) unstable; urgency=low * debianizing https://github.com/AndrewFromMelbourne/raspi2png diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control index bbb5888..0c4433d 100644 --- a/debian/control +++ b/debian/control @@ -2,11 +2,14 @@ Source: raspi2png Section: utils Priority: optional Maintainer: Przemyslaw Wegrzyn -Build-Depends: debhelper (>= 9), libpng12-dev, libraspberrypi-dev -Standards-Version: 3.9.5 +Build-Depends: + debhelper-compat (= 12), + libpng-dev, + libraspberrypi-dev, +Standards-Version: 4.5.0 Homepage: https://github.com/AndrewFromMelbourne/raspi2png/ Package: raspi2png -Architecture: any +Architecture: armhf arm64 Depends: ${shlibs:Depends}, ${misc:Depends} Description: Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG file. diff --git a/raspi2png b/raspi2png deleted file mode 100755 index 76672975c4499f38d020fe28c739bbef7d121031..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13880 zcmeHOeRx#WnLl?jgpdT8X!s}wxk$jMnPJe##x&9(0pf}fFuJthP9~WfX6$5UIx`Wd zX^qG#RU#3iVAq&&>+`H`v74>frWCrdLYJ+u)?MtfNVoIB-9ij3?Sq0VlKuVe2i%No z_u0SN=h>V*Z{E-Ip7*@xoO{olIrGS(rHds=5@xZ9GC^+VWJy#|cniQT##9JdjDzl4 zF_rqr!RbOAoGxjQ2NQzbfLvhKt$-y#Mg@YY&w;K1d;{7gd;vUxdWbauGAKzLL0g0| zhKx4nT?Cs30}vbruwB-+5zQfhA{b7oH)DuE7D3yDTF42eZiO26f&E-zeFtDA^w#$C z;ETZeY-&z0&@?CLa|Q#Uw)IYLwAJ6@iiKUbLZ#Wz2kn+DyN@Eld}uKP(?_u(qkh4n zcXr+V^tWAm=DqX9laD+dniPHH`?Cx?`WXk<(v$Lc)aGu)AjraAQ}kA$knFQ3bwDLV zqGsP?B~LmwE?5x1N_33rv)8=(R^Fo%60$9?1}W_jqJwR+Fu&|0$C7^Y0R@2ZfC&J$ zcQxP|z$Cy_0L!&H64QXM2h0R8#@T=}z>R>L0T?oESU9DajN1U#G7rq{fG+~>c>VVA zpAKzuJpbsOuSzpNdF6roZ-4t6PsJuke_L_l@iWi2e{d-C(#4DG!cPr+%{FJ*9Unh9 zZs9Ng`dsIGxBu>`lESL(1y637wE9b*4DZR`H)(a@4ZZDU)3%g+<5bav@x|$va=-Wf z4PXAx?HevGAKbfR`D+j6?fhix{BJ(r{?wt~*S=HyTzgmB#_?Z$=W{%AwgD5u{VDik3S!56abK-#J*et+gdU1**hA_dd#>g$s(mS*G8)1LIZPVsm zk(ex|X6XmPAB3L80sY%q`njmTd8#BDp=Wz$3E}%;J~9evie!oK^ob@F&net`YX{n_2pgz+3Zk zD$D=otp4<7)t{Kfzm!!!H%q@di+>aR`Ku(c3yYTVy^y8foyGqk%YOv=0Zaei1R^`qde{cp;$pNjE1Yviv8Pm$SK`fH%)yM~4F|45_se;ogXS?$fv;?HK; zAAtYM@lO&*vh?$zZyay7Cqz${{v`C){ydP?-ncCOgAwgb7EgjV3*#4f7c@1udi>#7 z94`UkxvSwGk57pzYXh;k5^cC=VK5w08oW(GMR+`GTf-qwEbfiQJs#ckiiQt0dwhXd zq}3Z*uMt7-22XP^98<)VG~tL68li|P&2djmiDwC8;kIbA;%Sa5-uOsQQN_?f<@5Nw zaqpF@`jnuORW%m!Mq>W($hH_fV_vJoJ%Lb5SeO|C7l<=ukkBY>jwYLe_eWA47J@o$g=j75dT2KFkx%N+8H?HS4Uh9=&YQ#>Lwd zj>ZM*$HPHP03{j?h0#*8H;!%!qe;R3qiNXr!fmJ;X^S_DR;9H$vO%=yBj4%`qM8Ut zFniY05UvCg41pH8Xwf1=-Dn^bZxOMeqR?R!cHt~qRAUmLf%$Iv_uum zO+_1akEbaX)2&eD63yAFamc+!n^<$&9BcEmV4Pq>Cua4#mV@#ILY}smf)R^`*G9dq zW+1GiO@_9Zcda6pEWPW_g`Qhn6{3FGlDYFdZgY)s_ap)I|D^Q&AF-~pL1x3>Wg9M0 za(wHVwW()qoAzJ#WA4gyPv*{&I?|H300rOIGN3pRz&6P)mQaa8eE}L8sm~dquQ2M< zKC<*CY`<(`g;9Sep22)K@L5)j2MOO%#Z&ZWbul(oh2SS)!{s2xrl6P@8>lJ7*!z|c zV*@4=V>4Gu{3qCt5nqRW1u-^zZsJ?8S0~11uaX#>yK3T@LevmrGgnKD9@Y`xA;ePR zN+Ifrv0-f>#!GS)F*b{9h_PpHBt}1c#MmhMiDf(%iLnWc5Kk5&PCQYF^~BgLwiAyP zqJy|dh)u-TW3NH%#GaRUt`J?sRYG(V-z3Bi;u+Wj5#vKhg7^j@ULnSZj8}=T!XCHA zdGbd#@nK%a-V^quQ?)01)vJ~MFcOOl;x^ggcQD?oM@#oJi%m6DhkRks1r#YtZ47 zXGXzCtXg+X`c`poCg-=k+rJ{j;6VqTD}Nw(743FqwY@%z&yFo<(KlLX+8qZ-$bpO; z{CIeHP`F=E%Ru*o&PP6l10Y^d%aM;#(W!nvOFo-9>`0_`X31s9^F=*!n@94*u@eKGG&KwXj)CJFzN*CqaH5#%u=o zeBkAj*Vm`QiqceT(BJJuk^HFz`yGPwD_h1gJ&eR|#x7?}zsSrm?9h9xeRHIH! zU+4R!?w$ySDj~~(UP624;YUXO zJlK?4>VFFP$H?=x0$Z}HYV2wBS#{hr_VjNG`cMDE!~Lg4!4sz$=fK0Coi67S*PIRg zPe9Kx!fQn9cPDuE`@eww6}@VGX|Eb7zTEFakRO1brO;JCx5}dX8FX(!XNT`N#=k(u z^8mj78FJySPp?6Y-KwY(%V%CzF!n z@uVbgO!qauhcS8&v8_(M(fCBlUcV@9AJ~$#CzmB{jsq&T7Dp@4-bVMvq~v}q$(VCG zo=8?hHU>T!_wnIj97V0jT-BA33cC_TD(3+B^zd-L?d3!&W$@5RuqpZ#_*ysD++%6x zYZYj_dtsXSY|!Y(lFVPdE>AL_uWLS5W_F{kdi1f;q31>F+L-*Ip<_JEGuI^B{X0Yc z3F25~$nA+c)8B=>vad%iz}&E5O!=P3krSyL%+<3J)*)r+R}f?8fzR0n9|7M4zG+S( z^NXThH7I)2i=PdD_#r^l)Tgn%n<^t_t{-d(^ZVvvPS-!Hj)7m=mK$x^ux9h{>>VdM zPdd=ILV$4S^W<3Wp%mAf6SgJr#d?y6Y0tqD^!Z=V7Hxh2%z4GO+>Jf^mqvQ_*LC#l zM-Gl|-!vns)vMW*J_I|vxIcv){G88w%8x=8!P-Ip(jS4&W1McpiTTOr?HJ_cQ^@OJ zyBiq0xXj(Z?o6NAy7xrCyH`!fz3LIi<@K6^&9RHag9jihL!Fmc2hZpMjMZk?Mo>r8 zY}0aaO!L>J{uG$+{M#pe*8H_wBvMg4O6(d_hR<38B^J#=Nz zIiOo*(d~ttDK)6)KCI0hN5|eNNxnz0284T`3jV}CwDBKU zBN5nc!Q9xg0D$=}WaM6Ss|xxi+}-MIIgybtr{Y*MUovD<44DtIDnoXIA!~r_HbXYi zkkvxwrp(c;=8Ht8#n8J9eHrv+l%ZXDMz1O(jzxyebi>90o9Tw^T0rx`YL44W?4 zoVzg6rr5ACa}$BhY1ptm=9IBCLUxieBR7$ny(g~2eBr$2JlK4#Bwhg=1e^dkFxSff zob!G_JK#k?Ki~-9ET94Nz7*gF_yFC2J%BSy^!<2UBc6ZgcW&d>$f#+mb zBJ~VnS?ujgoq1w!o~Xgtl%DldCZmyH_Eg^Y43uySWac52bd;T9Ru z$}NGQBFDqBewZc;VV?WBpk@1IKBdLm7L3b*7&>_)T^c_1_{*JsxD2!+3$oF(5p`nl ztb_~|s_XG+=_q%uyHr(AQ&xLMT}{W9^}3c!l{=f^0VhkcMJQ|8lj+M1?d{f>wG@^+ zeUR%(4TR*F(i{%?VyJMbud{qwCA~c(*X7Py)LQ9{MUe352Dv^Uo1>r)f^5X6k3zXK z26OG`?oyItLmw?8$LIQmmbt$vlOOwrWR-On7sZud24H&R-R&T33Zh zI4f2qw}p80%%S6PW&0U9neL>%P z;Zppb7F>~2baRh48uf0_%}p9ky{&;}G>99QF5Lkx=?NE(ms*t&WOV0^$D@I!wzzVo zgJ>rA3Z(!t&MwXt{dXJsZ#GO*bLMe=jy3G`-&g4K*0kfAVVMCi?YgjDy5N9=WERs7 zSGWZ35QNz-*VQiA9RzTFvCxiy`xn}86==ux)`3Nl1mOOH7B_9U?iK^MUTDYl*@z&x zF3kehT3LqwTwAo`y4sBe+z#4omvX{t0M{aEuE$Cwsu48XrCYNf4}#`zDrm>`yaRSJ zXwx6zeDgeGBKw9|#cDN>bsnCXnSnGqv;mdej`uND8 IiA=ly2G-{@rvLx| From d21fe4f8883354f538a1858f5ac8c537645d3b5c Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 2 Mar 2021 10:51:06 +0000 Subject: [PATCH 02/20] Add Lintian overrides --- debian/control | 6 ++++-- debian/raspi2png.lintian-overrides | 3 +++ debian/source/lintian-overrides | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 debian/raspi2png.lintian-overrides create mode 100644 debian/source/lintian-overrides diff --git a/debian/control b/debian/control index 0c4433d..ed81eaa 100644 --- a/debian/control +++ b/debian/control @@ -6,10 +6,12 @@ Build-Depends: debhelper-compat (= 12), libpng-dev, libraspberrypi-dev, -Standards-Version: 4.5.0 +Standards-Version: 4.5.1 Homepage: https://github.com/AndrewFromMelbourne/raspi2png/ Package: raspi2png Architecture: armhf arm64 Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG file. +Description: Raspberry Pi Screenshot Utility + Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG + file. diff --git a/debian/raspi2png.lintian-overrides b/debian/raspi2png.lintian-overrides new file mode 100644 index 0000000..2c61965 --- /dev/null +++ b/debian/raspi2png.lintian-overrides @@ -0,0 +1,3 @@ +raspi2png: no-manual-page usr/bin/raspi2png +raspi2png: hardening-no-bindnow usr/bin/raspi2png +raspi2png: hardening-no-fortify-functions usr/bin/raspi2png diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 0000000..4015c94 --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1 @@ +raspi2png source: debian-watch-file-is-missing From a3f1c96bd0c06bf39b68b3a453c7ca2016043625 Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:10:21 +0000 Subject: [PATCH 03/20] Add workflow files for releasing --- ...-changelog-in-pr-on-commits-to-master.yaml | 73 +++++ .../workflows/deploy-release-on-publish.yml | 68 +++++ ...nd-draft-release-on-changelog-pr-merge.yml | 289 ++++++++++++++++++ 3 files changed, 430 insertions(+) create mode 100644 .github/workflows/bump-changelog-in-pr-on-commits-to-master.yaml create mode 100644 .github/workflows/deploy-release-on-publish.yml create mode 100644 .github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml diff --git a/.github/workflows/bump-changelog-in-pr-on-commits-to-master.yaml b/.github/workflows/bump-changelog-in-pr-on-commits-to-master.yaml new file mode 100644 index 0000000..a6379b4 --- /dev/null +++ b/.github/workflows/bump-changelog-in-pr-on-commits-to-master.yaml @@ -0,0 +1,73 @@ +name: Create/Update Changelog PR on Commits to 'master' + +on: + push: + branches: [ "master" ] + +jobs: + create-pr: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Set up Debian Docker container for changelog patching + run: | + docker create --name chglog --volume ${{ github.workspace }}:${{ github.workspace }} --workdir ${{ github.workspace }}/ --tty pitop/gbp-dch-gen:latest sleep inf + docker start chglog + docker exec chglog git config --global user.name "pi-top" + docker exec chglog git config --global user.email "deb-maintainers@pi-top.com" + + # General settings: + # Use git information, not system information + # Ignore branch in case of debugging + + # Bump changelog to latest snapshot, as with CI builds + - name: Patch changelog (snapshot) + run: | + tag=$(git tag -l v* | sort -V | tail -n1) + commit=$(git show-ref -s ${tag}) + commit_diff=$(git rev-list --count ${commit}..HEAD) + + docker exec chglog gbp dch --verbose --git-author --ignore-branch --snapshot \ + --since=${commit} --snapshot-number=${commit_diff} + + - name: Show updated changelog + run: | + cat debian/changelog + + # Then squash into one release + # '--spawn-editor=snapshot' = don't try to open text editor + - name: Patch changelog (release) + run: | + docker exec chglog gbp dch --verbose --git-author --ignore-branch --release \ + --distribution=buster --spawn-editor=snapshot + + - name: Show updated changelog + run: | + cat debian/changelog + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + branch: ${{ secrets.CI_CHANGELOG_BUMP_BRANCH }} + commit-message: Bump debian/changelog with proposed change for next release + title: "[CI] Update debian/changelog for next release" + body: | + Proposal for next version's changelog, automatically updated on each push to master. + + ### Release Process + - [ ] Modify the changelog as necessary (e.g. amend version, tidy format) + - [ ] Mark as ready for review + - [ ] Merge into master + + ### What Happens Next? + This will trigger a workflow that [prepares a GitHub Release](../tree/master/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml) by tagging the released version in the changelog and creating a draft release. + Publishing this Release will trigger the [release deployment](../tree/master/.github/workflows/deploy-release-on-publish.yml) workflow, that uploads to public release repositories, etc. + + Note: tests will not run on this branch until a user acts upon this PR/branch. Close the PR and reopen to trigger tests. + See [here](https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs) for more info. + draft: true + labels: "ci" diff --git a/.github/workflows/deploy-release-on-publish.yml b/.github/workflows/deploy-release-on-publish.yml new file mode 100644 index 0000000..2a3c44b --- /dev/null +++ b/.github/workflows/deploy-release-on-publish.yml @@ -0,0 +1,68 @@ +name: Deploy Published Release + +on: + push: + branches: [ "ci-test-publish-release-*" ] + release: + types: [published] + +jobs: + add-stable-tag: + if: github.event_name == 'release' && github.event.action == 'published' + runs-on: ubuntu-20.04 + steps: + - name: Get latest release's version + id: release_version + run: | + sudo apt-get install -y curl jq wget + + LATEST_VERSION=$(curl -s ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/latest | jq -r ".target_commitish") + echo "::set-output name=latest_version_commit::$LATEST_VERSION" + + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Tag release commit as 'stable' for ReadTheDocs + uses: rickstaa/action-create-tag@v1 + with: + tag: "stable" + commit_sha: ${{ steps.release_version.outputs.latest_version_commit }} + force_push_tag: true + + deploy-release: + runs-on: ubuntu-20.04 + steps: + - name: Download latest release's assets + run: | + sudo apt-get install -y curl jq wget + curl -s "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest" | jq -r ".assets | .[] | .browser_download_url" | xargs -n1 wget + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install twine + + - name: Deploy to TestPyPI + if: github.event_name != 'release' || github.event.action != 'published' + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload --repository testpypi --verbose *.whl + + - name: Deploy to PyPI + if: github.event_name == 'release' && github.event.action == 'published' + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload --verbose *.whl + + # TODO: publish to apt repository diff --git a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml new file mode 100644 index 0000000..df0d8d9 --- /dev/null +++ b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml @@ -0,0 +1,289 @@ +name: Create Draft GitHub Release And Tag On Merging Changelog PR + +on: + pull_request: + types: [closed] + +jobs: + check-should-run: + runs-on: ubuntu-20.04 + outputs: + should_run: ${{ steps.check_should_run.outputs.should_run }} + steps: + + - name: Set 'should run' variable + id: check_should_run + env: + CI_CHANGELOG_BUMP_BRANCH: ${{ secrets.CI_CHANGELOG_BUMP_BRANCH }} + PR_MERGED: ${{ github.event.pull_request.merged }} + run: | + if [[ "${GITHUB_HEAD_REF}" == "${CI_CHANGELOG_BUMP_BRANCH}" ]] && [[ "${PR_MERGED}" == "true" ]]; then + conditions_met="true" + else + conditions_met="false" + fi + echo "::set-output name=should_run::${conditions_met}" + + add-version-tag: + needs: [ check-should-run ] + if: needs.check-should-run.outputs.should_run == 'true' + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Create and push Debian version tag + run: | + new_version="$(head -n1 debian/changelog | awk '{print $2}' | cut -d'-' -f1 | sed "s/(//g" | sed "s/)//g")" + git tag --force "v${new_version}" + git push --force --tags + + build-python: + needs: [ add-version-tag ] + runs-on: ubuntu-20.04 + steps: + - name: GitHub Environment Variables Action + uses: FranzDiebold/github-env-vars-action@v1.2.1 + + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + + - name: Build + # Create source distribution (sdist) and wheel (bdist_wheel) + # By default, both will be placed in dist/ under the current directory + run: | + python setup.py sdist bdist_wheel + + - name: Upload Python distribution artifacts + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-py" + path: "${{ github.workspace }}/dist" + + build-debian: + needs: [ add-version-tag ] + runs-on: ubuntu-20.04 + steps: + - name: GitHub Environment Variables Action + uses: FranzDiebold/github-env-vars-action@v1.2.1 + + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Build Debian package + uses: pi-top/action-debian-package@v0.2.2 + with: + source_directory: "${{ github.workspace }}" + artifacts_directory: "${{ github.workspace }}/artifacts/bin" + + docker_image: "pitop/deb-build:latest" + distribution: "buster-backports" + + lintian_opts: "--dont-check-part nmu --no-tag-display-limit --display-info --show-overrides --fail-on error --fail-on warning --fail-on info" + # Package uses latest packaging syntax and Lintian opts/tags + dpkg_buildpackage_opts: "--no-sign --no-check-builddeps --post-clean" + + - name: Separate Debian source package files from binary + run: | + mkdir -p ${{ github.workspace }}/artifacts/src/ + mv ${{ github.workspace }}/artifacts/bin/* ${{ github.workspace }}/artifacts/src/ + mv ${{ github.workspace }}/artifacts/src/*.deb ${{ github.workspace }}/artifacts/bin/ + + - name: Upload Debian source package files + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" + path: "${{ github.workspace }}/artifacts/src/" + + - name: Upload Debian binary packages + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" + path: "${{ github.workspace }}/artifacts/bin/" + + create-draft-release: + runs-on: ubuntu-20.04 + needs: [ build-debian, build-python ] + steps: + - name: GitHub Environment Variables Action + uses: FranzDiebold/github-env-vars-action@v1.2.1 + + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Get Debian Version + id: get_deb_version + run: | + DEB_VER=$(head -n1 debian/changelog | awk '{print $2}' | cut -d'-' -f1 | sed "s/(//g" | sed "s/)//g") + echo "::set-output name=deb_ver::$DEB_VER" + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "v${{ steps.get_deb_version.outputs.deb_ver }}" + release_name: "v${{ steps.get_deb_version.outputs.deb_ver }}" + draft: true + prerelease: false + body: | + The SDK and its related CI workflows are still in active development and subject to breaking changes. + However, this release is regarded as "fairly stable" and the SDK itself should work in most of the detailed use-cases. + + - name: Download Python artifact + uses: actions/download-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-py" + path: "./py" + + - name: Get Python wheel filename + id: get_py_whl_filename + run: | + cd ./py + WHL_NAME=$(ls | grep "^pitop-.*.whl$") + echo "::set-output name=filename::$WHL_NAME" + + # More info: + # https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + - name: Upload Python wheel + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./py/${{ steps.get_py_whl_filename.outputs.filename }} + asset_name: ${{ steps.get_py_whl_filename.outputs.filename }} + asset_content_type: text/plain + + - name: Download Debian binary artifacts + uses: actions/download-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" + path: "./deb/" + + - name: Download Debian source artifacts + uses: actions/download-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" + path: "./deb-src/" + + - name: Get main package filename + id: get_deb_main_pkg_filename + run: | + cd ./deb + PKG_NAME=$(ls | grep "^python3-pitop_.*.deb$") + echo "::set-output name=filename::$PKG_NAME" + + - name: Upload main Debian package + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./deb/${{ steps.get_deb_main_pkg_filename.outputs.filename }} + asset_name: ${{ steps.get_deb_main_pkg_filename.outputs.filename }} + asset_content_type: application/vnd.debian.binary-package + + - name: Get docs package filename + id: get_deb_docs_pkg_filename + run: | + cd ./deb + PKG_NAME=$(ls | grep "^python3-pitop-doc_.*.deb$") + echo "::set-output name=filename::$PKG_NAME" + + - name: Upload docs Debian package + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./deb/${{ steps.get_deb_docs_pkg_filename.outputs.filename }} + asset_name: ${{ steps.get_deb_docs_pkg_filename.outputs.filename }} + asset_content_type: application/vnd.debian.binary-package + + - name: Get dsc filename + id: get_dsc_filename + run: | + cd ./deb-src + DSC_FILENAME=$(ls | grep "^py-pitop-sdk_.*.dsc$") + echo "::set-output name=filename::$DSC_FILENAME" + + - name: Upload dsc filename + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./deb-src/${{ steps.get_dsc_filename.outputs.filename }} + asset_name: ${{ steps.get_dsc_filename.outputs.filename }} + asset_content_type: text/plain + + - name: Get buildinfo filename + id: get_buildinfo_filename + run: | + cd ./deb-src + BUILDINFO_FILENAME=$(ls | grep "^py-pitop-sdk_.*.buildinfo$") + echo "::set-output name=filename::$BUILDINFO_FILENAME" + + - name: Upload buildinfo filename + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./deb-src/${{ steps.get_buildinfo_filename.outputs.filename }} + asset_name: ${{ steps.get_buildinfo_filename.outputs.filename }} + asset_content_type: text/plain + + - name: Get changes filename + id: get_changes_filename + run: | + cd ./deb-src + CHANGES_FILENAME=$(ls | grep "^py-pitop-sdk_.*.changes$") + echo "::set-output name=filename::$CHANGES_FILENAME" + + - name: Upload changes filename + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./deb-src/${{ steps.get_changes_filename.outputs.filename }} + asset_name: ${{ steps.get_changes_filename.outputs.filename }} + asset_content_type: text/plain + + - name: Get source filename + id: get_source_filename + run: | + cd ./deb-src + SOURCE_FILENAME=$(ls | grep "^py-pitop-sdk_.*.tar.xz$") + echo "::set-output name=filename::$SOURCE_FILENAME" + + - name: Upload source filename + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./deb-src/${{ steps.get_source_filename.outputs.filename }} + asset_name: ${{ steps.get_source_filename.outputs.filename }} + asset_content_type: text/plain From d28df2c4e1ad3218bab4a723ad808a05c5c83069 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:15:35 +0000 Subject: [PATCH 04/20] [CI] Update debian/changelog for next release (#2) --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7bcbf70..77e53ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -raspi2png (0.1-1+nmu1) unstable; urgency=low +raspi2png (0.1-1+nmu1) unstable; urgency=medium * Non-maintainer upload. * compat level 12 From 39779839fb1754b0fb88543f44f0408cba7073cc Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:18:58 +0000 Subject: [PATCH 05/20] Update release workflow --- .../workflows/deploy-release-on-publish.yml | 68 -------------- ...nd-draft-release-on-changelog-pr-merge.yml | 88 ++----------------- 2 files changed, 6 insertions(+), 150 deletions(-) delete mode 100644 .github/workflows/deploy-release-on-publish.yml diff --git a/.github/workflows/deploy-release-on-publish.yml b/.github/workflows/deploy-release-on-publish.yml deleted file mode 100644 index 2a3c44b..0000000 --- a/.github/workflows/deploy-release-on-publish.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Deploy Published Release - -on: - push: - branches: [ "ci-test-publish-release-*" ] - release: - types: [published] - -jobs: - add-stable-tag: - if: github.event_name == 'release' && github.event.action == 'published' - runs-on: ubuntu-20.04 - steps: - - name: Get latest release's version - id: release_version - run: | - sudo apt-get install -y curl jq wget - - LATEST_VERSION=$(curl -s ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/latest | jq -r ".target_commitish") - echo "::set-output name=latest_version_commit::$LATEST_VERSION" - - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Tag release commit as 'stable' for ReadTheDocs - uses: rickstaa/action-create-tag@v1 - with: - tag: "stable" - commit_sha: ${{ steps.release_version.outputs.latest_version_commit }} - force_push_tag: true - - deploy-release: - runs-on: ubuntu-20.04 - steps: - - name: Download latest release's assets - run: | - sudo apt-get install -y curl jq wget - curl -s "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest" | jq -r ".assets | .[] | .browser_download_url" | xargs -n1 wget - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install twine - - - name: Deploy to TestPyPI - if: github.event_name != 'release' || github.event.action != 'published' - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - twine upload --repository testpypi --verbose *.whl - - - name: Deploy to PyPI - if: github.event_name == 'release' && github.event.action == 'published' - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - twine upload --verbose *.whl - - # TODO: publish to apt repository diff --git a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml index df0d8d9..def3ed7 100644 --- a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml +++ b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml @@ -40,40 +40,6 @@ jobs: git tag --force "v${new_version}" git push --force --tags - build-python: - needs: [ add-version-tag ] - runs-on: ubuntu-20.04 - steps: - - name: GitHub Environment Variables Action - uses: FranzDiebold/github-env-vars-action@v1.2.1 - - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - - name: Build - # Create source distribution (sdist) and wheel (bdist_wheel) - # By default, both will be placed in dist/ under the current directory - run: | - python setup.py sdist bdist_wheel - - - name: Upload Python distribution artifacts - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-py" - path: "${{ github.workspace }}/dist" - build-debian: needs: [ add-version-tag ] runs-on: ubuntu-20.04 @@ -119,7 +85,7 @@ jobs: create-draft-release: runs-on: ubuntu-20.04 - needs: [ build-debian, build-python ] + needs: build-debian steps: - name: GitHub Environment Variables Action uses: FranzDiebold/github-env-vars-action@v1.2.1 @@ -149,31 +115,6 @@ jobs: The SDK and its related CI workflows are still in active development and subject to breaking changes. However, this release is regarded as "fairly stable" and the SDK itself should work in most of the detailed use-cases. - - name: Download Python artifact - uses: actions/download-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-py" - path: "./py" - - - name: Get Python wheel filename - id: get_py_whl_filename - run: | - cd ./py - WHL_NAME=$(ls | grep "^pitop-.*.whl$") - echo "::set-output name=filename::$WHL_NAME" - - # More info: - # https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - - name: Upload Python wheel - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./py/${{ steps.get_py_whl_filename.outputs.filename }} - asset_name: ${{ steps.get_py_whl_filename.outputs.filename }} - asset_content_type: text/plain - - name: Download Debian binary artifacts uses: actions/download-artifact@v2 with: @@ -190,7 +131,7 @@ jobs: id: get_deb_main_pkg_filename run: | cd ./deb - PKG_NAME=$(ls | grep "^python3-pitop_.*.deb$") + PKG_NAME=$(ls | grep "^raspi2png_.*.deb$") echo "::set-output name=filename::$PKG_NAME" - name: Upload main Debian package @@ -203,28 +144,11 @@ jobs: asset_name: ${{ steps.get_deb_main_pkg_filename.outputs.filename }} asset_content_type: application/vnd.debian.binary-package - - name: Get docs package filename - id: get_deb_docs_pkg_filename - run: | - cd ./deb - PKG_NAME=$(ls | grep "^python3-pitop-doc_.*.deb$") - echo "::set-output name=filename::$PKG_NAME" - - - name: Upload docs Debian package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./deb/${{ steps.get_deb_docs_pkg_filename.outputs.filename }} - asset_name: ${{ steps.get_deb_docs_pkg_filename.outputs.filename }} - asset_content_type: application/vnd.debian.binary-package - - name: Get dsc filename id: get_dsc_filename run: | cd ./deb-src - DSC_FILENAME=$(ls | grep "^py-pitop-sdk_.*.dsc$") + DSC_FILENAME=$(ls | grep "^raspi2png_.*.dsc$") echo "::set-output name=filename::$DSC_FILENAME" - name: Upload dsc filename @@ -241,7 +165,7 @@ jobs: id: get_buildinfo_filename run: | cd ./deb-src - BUILDINFO_FILENAME=$(ls | grep "^py-pitop-sdk_.*.buildinfo$") + BUILDINFO_FILENAME=$(ls | grep "^raspi2png_.*.buildinfo$") echo "::set-output name=filename::$BUILDINFO_FILENAME" - name: Upload buildinfo filename @@ -258,7 +182,7 @@ jobs: id: get_changes_filename run: | cd ./deb-src - CHANGES_FILENAME=$(ls | grep "^py-pitop-sdk_.*.changes$") + CHANGES_FILENAME=$(ls | grep "^raspi2png_.*.changes$") echo "::set-output name=filename::$CHANGES_FILENAME" - name: Upload changes filename @@ -275,7 +199,7 @@ jobs: id: get_source_filename run: | cd ./deb-src - SOURCE_FILENAME=$(ls | grep "^py-pitop-sdk_.*.tar.xz$") + SOURCE_FILENAME=$(ls | grep "^raspi2png_.*.tar.xz$") echo "::set-output name=filename::$SOURCE_FILENAME" - name: Upload source filename From 76c24ab1c07702080f17b866d28d62c2d191945c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:22:16 +0000 Subject: [PATCH 06/20] [CI] Update debian/changelog for next release (#3) --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 77e53ec..94aa8c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,7 +5,7 @@ raspi2png (0.1-1+nmu1) unstable; urgency=medium * libpng12-dev --> libpng-dev * Architecture: armhf arm64 - -- Mike Roberts Tue, 02 Mar 2021 10:26:40 +0000 + -- pi-top Tue, 02 Mar 2021 11:19:35 +0000 raspi2png (0.1-1) unstable; urgency=low From d303dd4a3ad10235a1e3935fbf2b46842ec6fd25 Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:35:58 +0000 Subject: [PATCH 07/20] Target armhf --- .../workflows/tag-and-draft-release-on-changelog-pr-merge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml index def3ed7..3ee61a9 100644 --- a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml +++ b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml @@ -55,6 +55,8 @@ jobs: - name: Build Debian package uses: pi-top/action-debian-package@v0.2.2 with: + target_architecture: "armhf" + source_directory: "${{ github.workspace }}" artifacts_directory: "${{ github.workspace }}/artifacts/bin" From 5e6ce5763d5127ca87f3bb8726bb94c7d4f726f6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:48:05 +0000 Subject: [PATCH 08/20] [CI] Update debian/changelog for next release (#4) --- debian/changelog | 9 +++++---- debian/source/format | 2 +- debian/source/lintian-overrides | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 debian/source/lintian-overrides diff --git a/debian/changelog b/debian/changelog index 94aa8c8..e40ca71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,12 @@ -raspi2png (0.1-1+nmu1) unstable; urgency=medium +raspi2png (0.2+nmu1) unstable; urgency=medium * Non-maintainer upload. + * Native package * compat level 12 - * libpng12-dev --> libpng-dev - * Architecture: armhf arm64 + * Update build dependency: libpng12-dev --> libpng-dev + * Hard-code possible architectures to ARM only (armhf, arm64) - -- pi-top Tue, 02 Mar 2021 11:19:35 +0000 + -- pi-top Tue, 02 Mar 2021 11:36:38 +0000 raspi2png (0.1-1) unstable; urgency=low diff --git a/debian/source/format b/debian/source/format index 163aaf8..89ae9db 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides deleted file mode 100644 index 4015c94..0000000 --- a/debian/source/lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -raspi2png source: debian-watch-file-is-missing From 31b0f7c85278c29b9956501c3d5598b4c230d960 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 11:58:37 +0000 Subject: [PATCH 09/20] [CI] Update debian/changelog for next release (#5) --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e40ca71..a46c064 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,9 +6,9 @@ raspi2png (0.2+nmu1) unstable; urgency=medium * Update build dependency: libpng12-dev --> libpng-dev * Hard-code possible architectures to ARM only (armhf, arm64) - -- pi-top Tue, 02 Mar 2021 11:36:38 +0000 + -- pi-top Tue, 02 Mar 2021 11:48:37 +0000 -raspi2png (0.1-1) unstable; urgency=low +raspi2png (0.1) unstable; urgency=medium * debianizing https://github.com/AndrewFromMelbourne/raspi2png From 41a1689a17a1c80ab070865b53713e40d2f6d4a9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 12:06:08 +0000 Subject: [PATCH 10/20] [CI] Update debian/changelog for next release (#6) --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index a46c064..b54542c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -raspi2png (0.2+nmu1) unstable; urgency=medium +raspi2png (0.1+nmu1) unstable; urgency=medium * Non-maintainer upload. * Native package From ae17a28be9514539b9f1dcf207d0d4527776dbdf Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 2 Mar 2021 14:48:30 +0000 Subject: [PATCH 11/20] Drop body text from release draft --- .../workflows/tag-and-draft-release-on-changelog-pr-merge.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml index 3ee61a9..57d627c 100644 --- a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml +++ b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml @@ -113,9 +113,6 @@ jobs: release_name: "v${{ steps.get_deb_version.outputs.deb_ver }}" draft: true prerelease: false - body: | - The SDK and its related CI workflows are still in active development and subject to breaking changes. - However, this release is regarded as "fairly stable" and the SDK itself should work in most of the detailed use-cases. - name: Download Debian binary artifacts uses: actions/download-artifact@v2 From 802a7d6cb6c6c9173d78fa30714e092555a6ed5d Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 4 May 2021 15:26:09 +0100 Subject: [PATCH 12/20] Update workflow files --- .github/workflows/build-on-all-commits.yml | 72 ------ .../workflows/build-on-commits-to-master.yml | 53 +++++ .github/workflows/build-on-prs-to-master.yml | 53 +++++ ...-changelog-in-pr-on-commits-to-master.yaml | 73 ------ .../create-draft-release-on-chglog-merge.yml | 105 +++++++++ ...nd-draft-release-on-changelog-pr-merge.yml | 212 ------------------ ...hangelog-draft-pr-on-commits-to-master.yml | 32 +++ Jenkinsfile | 3 + 8 files changed, 246 insertions(+), 357 deletions(-) delete mode 100644 .github/workflows/build-on-all-commits.yml create mode 100644 .github/workflows/build-on-commits-to-master.yml create mode 100644 .github/workflows/build-on-prs-to-master.yml delete mode 100644 .github/workflows/bump-changelog-in-pr-on-commits-to-master.yaml create mode 100644 .github/workflows/create-draft-release-on-chglog-merge.yml delete mode 100644 .github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml create mode 100644 .github/workflows/update-changelog-draft-pr-on-commits-to-master.yml create mode 100644 Jenkinsfile diff --git a/.github/workflows/build-on-all-commits.yml b/.github/workflows/build-on-all-commits.yml deleted file mode 100644 index 3d88b61..0000000 --- a/.github/workflows/build-on-all-commits.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Build Package on All Commits - -# Don't run on branches intended for CI modifications -on: - push: - branches-ignore: - - "ci-test-*" - -jobs: - build-debian-package: - runs-on: ubuntu-20.04 - steps: - - name: GitHub Environment Variables Action - uses: FranzDiebold/github-env-vars-action@v1.2.1 - - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Set up Debian Docker container for changelog patching - run: | - docker create --name chglog --volume ${{ github.workspace }}:${{ github.workspace }} --workdir ${{ github.workspace }}/ --tty pitop/gbp-dch-gen:latest sleep inf - docker start chglog - docker exec chglog git config --global user.name "pi-top" - docker exec chglog git config --global user.email "deb-maintainers@pi-top.com" - - - name: Patch changelog (snapshot) - run: | - tag=$(git tag -l v* | sort -V | tail -n1) - commit=$(git show-ref -s ${tag}) - commit_diff=$(git rev-list --count ${commit}..HEAD) - - docker exec chglog gbp dch --verbose --git-author --ignore-branch --snapshot \ - --since=${commit} --snapshot-number=${commit_diff} - - - name: Show updated changelog - run: | - cat debian/changelog - - - name: Build Debian package - uses: pi-top/action-debian-package@v0.2.2 - with: - target_architecture: "armhf" - - source_directory: "${{ github.workspace }}" - artifacts_directory: "${{ github.workspace }}/artifacts/bin" - - docker_image: "pitop/deb-build:latest" - distribution: "buster-backports" - - lintian_opts: "--dont-check-part nmu --no-tag-display-limit --display-info --show-overrides --fail-on error --fail-on warning --fail-on info" - # Package uses latest packaging syntax and Lintian opts/tags - dpkg_buildpackage_opts: "--no-sign --no-check-builddeps --post-clean" - - - name: Separate Debian source package files from binary - run: | - mkdir -p ${{ github.workspace }}/artifacts/src/ - mv ${{ github.workspace }}/artifacts/bin/* ${{ github.workspace }}/artifacts/src/ - mv ${{ github.workspace }}/artifacts/src/*.deb ${{ github.workspace }}/artifacts/bin/ - - - name: Upload Debian source package files - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" - path: "${{ github.workspace }}/artifacts/src/" - - - name: Upload Debian binary packages - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" - path: "${{ github.workspace }}/artifacts/bin/" diff --git a/.github/workflows/build-on-commits-to-master.yml b/.github/workflows/build-on-commits-to-master.yml new file mode 100644 index 0000000..523f87d --- /dev/null +++ b/.github/workflows/build-on-commits-to-master.yml @@ -0,0 +1,53 @@ +name: Latest Build + +on: + push: + branches: + - master + +jobs: + build-latest-debian-package: + runs-on: ubuntu-20.04 + steps: + - name: GitHub Environment Variables Action + uses: FranzDiebold/github-env-vars-action@v1.2.1 + + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Patch changelog (snapshot) + run: | + docker run --rm \ + --volume ${{ github.workspace }}:/src \ + -e RELEASE=0 \ + pitop/gbp-dch-gen:latest + + - name: Build Debian package + run: | + mkdir -p /tmp/artifacts/{src,bin} + docker run --privileged --rm docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 + docker run --rm \ + --volume ${{ github.workspace }}:/src \ + --volume /tmp/artifacts/bin:/build \ + -e LINTIAN_TAGS_TO_SUPPRESS="debian-changelog-line-too-long,spelling-error-in-changelog,unreleased-changelog-distribution" \ + --platform=linux/arm/v7 \ + pitop/deb-build:latest + + - name: Separate Debian source package files from binary + run: | + mv /tmp/artifacts/bin/* /tmp/artifacts/src/ + mv /tmp/artifacts/src/*.deb /tmp/artifacts/bin/ + + - name: Upload Debian source package files + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" + path: "/tmp/artifacts/src/" + + - name: Upload Debian binary packages + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" + path: "/tmp/artifacts/bin/" diff --git a/.github/workflows/build-on-prs-to-master.yml b/.github/workflows/build-on-prs-to-master.yml new file mode 100644 index 0000000..a8d2b32 --- /dev/null +++ b/.github/workflows/build-on-prs-to-master.yml @@ -0,0 +1,53 @@ +name: PR Build + +on: + pull_request: + branches: + - master + +jobs: + build-preview-debian-package: + runs-on: ubuntu-20.04 + steps: + - name: GitHub Environment Variables Action + uses: FranzDiebold/github-env-vars-action@v1.2.1 + + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Patch changelog (snapshot) + run: | + docker run --rm \ + --volume ${{ github.workspace }}:/src \ + -e RELEASE=0 \ + pitop/gbp-dch-gen:latest + + - name: Build Debian package + run: | + mkdir -p /tmp/artifacts/{src,bin} + docker run --privileged --rm docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 + docker run --rm \ + --volume ${{ github.workspace }}:/src \ + --volume /tmp/artifacts/bin:/build \ + -e LINTIAN_TAGS_TO_SUPPRESS="debian-changelog-line-too-long,spelling-error-in-changelog,unreleased-changelog-distribution" \ + --platform=linux/arm/v7 \ + pitop/deb-build:latest + + - name: Separate Debian source package files from binary + run: | + mv /tmp/artifacts/bin/* /tmp/artifacts/src/ + mv /tmp/artifacts/src/*.deb /tmp/artifacts/bin/ + + - name: Upload Debian source package files + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" + path: "/tmp/artifacts/src/" + + - name: Upload Debian binary packages + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" + path: "/tmp/artifacts/bin/" diff --git a/.github/workflows/bump-changelog-in-pr-on-commits-to-master.yaml b/.github/workflows/bump-changelog-in-pr-on-commits-to-master.yaml deleted file mode 100644 index a6379b4..0000000 --- a/.github/workflows/bump-changelog-in-pr-on-commits-to-master.yaml +++ /dev/null @@ -1,73 +0,0 @@ -name: Create/Update Changelog PR on Commits to 'master' - -on: - push: - branches: [ "master" ] - -jobs: - create-pr: - runs-on: ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Set up Debian Docker container for changelog patching - run: | - docker create --name chglog --volume ${{ github.workspace }}:${{ github.workspace }} --workdir ${{ github.workspace }}/ --tty pitop/gbp-dch-gen:latest sleep inf - docker start chglog - docker exec chglog git config --global user.name "pi-top" - docker exec chglog git config --global user.email "deb-maintainers@pi-top.com" - - # General settings: - # Use git information, not system information - # Ignore branch in case of debugging - - # Bump changelog to latest snapshot, as with CI builds - - name: Patch changelog (snapshot) - run: | - tag=$(git tag -l v* | sort -V | tail -n1) - commit=$(git show-ref -s ${tag}) - commit_diff=$(git rev-list --count ${commit}..HEAD) - - docker exec chglog gbp dch --verbose --git-author --ignore-branch --snapshot \ - --since=${commit} --snapshot-number=${commit_diff} - - - name: Show updated changelog - run: | - cat debian/changelog - - # Then squash into one release - # '--spawn-editor=snapshot' = don't try to open text editor - - name: Patch changelog (release) - run: | - docker exec chglog gbp dch --verbose --git-author --ignore-branch --release \ - --distribution=buster --spawn-editor=snapshot - - - name: Show updated changelog - run: | - cat debian/changelog - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - with: - branch: ${{ secrets.CI_CHANGELOG_BUMP_BRANCH }} - commit-message: Bump debian/changelog with proposed change for next release - title: "[CI] Update debian/changelog for next release" - body: | - Proposal for next version's changelog, automatically updated on each push to master. - - ### Release Process - - [ ] Modify the changelog as necessary (e.g. amend version, tidy format) - - [ ] Mark as ready for review - - [ ] Merge into master - - ### What Happens Next? - This will trigger a workflow that [prepares a GitHub Release](../tree/master/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml) by tagging the released version in the changelog and creating a draft release. - Publishing this Release will trigger the [release deployment](../tree/master/.github/workflows/deploy-release-on-publish.yml) workflow, that uploads to public release repositories, etc. - - Note: tests will not run on this branch until a user acts upon this PR/branch. Close the PR and reopen to trigger tests. - See [here](https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs) for more info. - draft: true - labels: "ci" diff --git a/.github/workflows/create-draft-release-on-chglog-merge.yml b/.github/workflows/create-draft-release-on-chglog-merge.yml new file mode 100644 index 0000000..f824275 --- /dev/null +++ b/.github/workflows/create-draft-release-on-chglog-merge.yml @@ -0,0 +1,105 @@ +name: Create Draft GitHub Release + +# Event: Merging Changelog PR (see 'check-should-run') +on: + pull_request: + types: [closed] + +jobs: + check-should-run: + runs-on: ubuntu-20.04 + outputs: + should_run: ${{ steps.check_should_run.outputs.should_run }} + steps: + - name: Set 'should run' variable + id: check_should_run + env: + CI_CHANGELOG_BUMP_BRANCH: ${{ secrets.CI_CHANGELOG_BUMP_BRANCH }} + PR_MERGED: ${{ github.event.pull_request.merged }} + run: | + if [[ "${GITHUB_HEAD_REF}" == "${CI_CHANGELOG_BUMP_BRANCH}" ]] && [[ "${PR_MERGED}" == "true" ]]; then + conditions_met="true" + else + conditions_met="false" + fi + echo "::set-output name=should_run::${conditions_met}" + + build-debian: + needs: check-should-run + if: needs.check-should-run.outputs.should_run == 'true' + runs-on: ubuntu-20.04 + steps: + - name: GitHub Environment Variables Action + uses: FranzDiebold/github-env-vars-action@v1.2.1 + + - name: Checkout code + uses: actions/checkout@v2.2.0 + + - name: Build Debian package + run: | + mkdir -p /tmp/artifacts/{src,bin} + docker run --privileged --rm docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 + docker run --rm \ + --volume ${{ github.workspace }}:/src \ + --volume /tmp/artifacts/bin:/build \ + -e LINTIAN_TAGS_TO_SUPPRESS="package-supports-alternative-init-but-no-init.d-script" \ + --platform=linux/arm/v7 \ + pitop/deb-build:latest + + - name: Separate Debian source package files from binary + run: | + mv /tmp/artifacts/bin/* /tmp/artifacts/src/ + mv /tmp/artifacts/src/*.deb /tmp/artifacts/bin/ + + - name: Upload Debian source package files + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" + path: "/tmp/artifacts/src/" + + - name: Upload Debian binary packages + uses: actions/upload-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" + path: "/tmp/artifacts/bin/" + + create-draft-release: + runs-on: ubuntu-20.04 + needs: build-debian + steps: + - name: GitHub Environment Variables Action + uses: FranzDiebold/github-env-vars-action@v1.2.1 + + - name: Checkout code + uses: actions/checkout@v2.2.0 + + - name: Download Debian binary artifacts + uses: actions/download-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" + path: "./deb/" + + - name: Download Debian source artifacts + uses: actions/download-artifact@v2 + with: + name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" + path: "./deb-src/" + + - name: Determine version + run: | + sudo apt install -y dpkg-dev + echo "VERSION=$(dpkg-parsechangelog -Sversion)" >> $GITHUB_ENV + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + tag_name: "v${{ env.VERSION }}" + name: "v${{ env.VERSION }}" + draft: true + prerelease: false + body: ${{ secrets.GH_RELEASE_BODY_TEXT }} + files: | + ./deb/* + ./deb-src/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml b/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml deleted file mode 100644 index 57d627c..0000000 --- a/.github/workflows/tag-and-draft-release-on-changelog-pr-merge.yml +++ /dev/null @@ -1,212 +0,0 @@ -name: Create Draft GitHub Release And Tag On Merging Changelog PR - -on: - pull_request: - types: [closed] - -jobs: - check-should-run: - runs-on: ubuntu-20.04 - outputs: - should_run: ${{ steps.check_should_run.outputs.should_run }} - steps: - - - name: Set 'should run' variable - id: check_should_run - env: - CI_CHANGELOG_BUMP_BRANCH: ${{ secrets.CI_CHANGELOG_BUMP_BRANCH }} - PR_MERGED: ${{ github.event.pull_request.merged }} - run: | - if [[ "${GITHUB_HEAD_REF}" == "${CI_CHANGELOG_BUMP_BRANCH}" ]] && [[ "${PR_MERGED}" == "true" ]]; then - conditions_met="true" - else - conditions_met="false" - fi - echo "::set-output name=should_run::${conditions_met}" - - add-version-tag: - needs: [ check-should-run ] - if: needs.check-should-run.outputs.should_run == 'true' - runs-on: ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Create and push Debian version tag - run: | - new_version="$(head -n1 debian/changelog | awk '{print $2}' | cut -d'-' -f1 | sed "s/(//g" | sed "s/)//g")" - git tag --force "v${new_version}" - git push --force --tags - - build-debian: - needs: [ add-version-tag ] - runs-on: ubuntu-20.04 - steps: - - name: GitHub Environment Variables Action - uses: FranzDiebold/github-env-vars-action@v1.2.1 - - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Build Debian package - uses: pi-top/action-debian-package@v0.2.2 - with: - target_architecture: "armhf" - - source_directory: "${{ github.workspace }}" - artifacts_directory: "${{ github.workspace }}/artifacts/bin" - - docker_image: "pitop/deb-build:latest" - distribution: "buster-backports" - - lintian_opts: "--dont-check-part nmu --no-tag-display-limit --display-info --show-overrides --fail-on error --fail-on warning --fail-on info" - # Package uses latest packaging syntax and Lintian opts/tags - dpkg_buildpackage_opts: "--no-sign --no-check-builddeps --post-clean" - - - name: Separate Debian source package files from binary - run: | - mkdir -p ${{ github.workspace }}/artifacts/src/ - mv ${{ github.workspace }}/artifacts/bin/* ${{ github.workspace }}/artifacts/src/ - mv ${{ github.workspace }}/artifacts/src/*.deb ${{ github.workspace }}/artifacts/bin/ - - - name: Upload Debian source package files - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" - path: "${{ github.workspace }}/artifacts/src/" - - - name: Upload Debian binary packages - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" - path: "${{ github.workspace }}/artifacts/bin/" - - create-draft-release: - runs-on: ubuntu-20.04 - needs: build-debian - steps: - - name: GitHub Environment Variables Action - uses: FranzDiebold/github-env-vars-action@v1.2.1 - - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Get Debian Version - id: get_deb_version - run: | - DEB_VER=$(head -n1 debian/changelog | awk '{print $2}' | cut -d'-' -f1 | sed "s/(//g" | sed "s/)//g") - echo "::set-output name=deb_ver::$DEB_VER" - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: "v${{ steps.get_deb_version.outputs.deb_ver }}" - release_name: "v${{ steps.get_deb_version.outputs.deb_ver }}" - draft: true - prerelease: false - - - name: Download Debian binary artifacts - uses: actions/download-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" - path: "./deb/" - - - name: Download Debian source artifacts - uses: actions/download-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" - path: "./deb-src/" - - - name: Get main package filename - id: get_deb_main_pkg_filename - run: | - cd ./deb - PKG_NAME=$(ls | grep "^raspi2png_.*.deb$") - echo "::set-output name=filename::$PKG_NAME" - - - name: Upload main Debian package - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./deb/${{ steps.get_deb_main_pkg_filename.outputs.filename }} - asset_name: ${{ steps.get_deb_main_pkg_filename.outputs.filename }} - asset_content_type: application/vnd.debian.binary-package - - - name: Get dsc filename - id: get_dsc_filename - run: | - cd ./deb-src - DSC_FILENAME=$(ls | grep "^raspi2png_.*.dsc$") - echo "::set-output name=filename::$DSC_FILENAME" - - - name: Upload dsc filename - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./deb-src/${{ steps.get_dsc_filename.outputs.filename }} - asset_name: ${{ steps.get_dsc_filename.outputs.filename }} - asset_content_type: text/plain - - - name: Get buildinfo filename - id: get_buildinfo_filename - run: | - cd ./deb-src - BUILDINFO_FILENAME=$(ls | grep "^raspi2png_.*.buildinfo$") - echo "::set-output name=filename::$BUILDINFO_FILENAME" - - - name: Upload buildinfo filename - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./deb-src/${{ steps.get_buildinfo_filename.outputs.filename }} - asset_name: ${{ steps.get_buildinfo_filename.outputs.filename }} - asset_content_type: text/plain - - - name: Get changes filename - id: get_changes_filename - run: | - cd ./deb-src - CHANGES_FILENAME=$(ls | grep "^raspi2png_.*.changes$") - echo "::set-output name=filename::$CHANGES_FILENAME" - - - name: Upload changes filename - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./deb-src/${{ steps.get_changes_filename.outputs.filename }} - asset_name: ${{ steps.get_changes_filename.outputs.filename }} - asset_content_type: text/plain - - - name: Get source filename - id: get_source_filename - run: | - cd ./deb-src - SOURCE_FILENAME=$(ls | grep "^raspi2png_.*.tar.xz$") - echo "::set-output name=filename::$SOURCE_FILENAME" - - - name: Upload source filename - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./deb-src/${{ steps.get_source_filename.outputs.filename }} - asset_name: ${{ steps.get_source_filename.outputs.filename }} - asset_content_type: text/plain diff --git a/.github/workflows/update-changelog-draft-pr-on-commits-to-master.yml b/.github/workflows/update-changelog-draft-pr-on-commits-to-master.yml new file mode 100644 index 0000000..05c9b06 --- /dev/null +++ b/.github/workflows/update-changelog-draft-pr-on-commits-to-master.yml @@ -0,0 +1,32 @@ +name: Update Changelog Draft PR + +on: + push: + branches: + - master + +jobs: + create-version-update-changelog-pr: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2.2.0 + with: + fetch-depth: 0 + + - name: Patch changelog (release) + run: | + docker run --rm \ + --volume ${{ github.workspace }}:/src \ + -e RELEASE=1 \ + pitop/gbp-dch-gen:latest + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + branch: ${{ secrets.CI_CHANGELOG_BUMP_BRANCH }} + commit-message: ${{ secrets.CI_CHANGELOG_BUMP_COMMIT_MESSAGE }} + title: ${{ secrets.CI_CHANGELOG_BUMP_TITLE }} + body: ${{ secrets.CI_CHANGELOG_BUMP_BODY }} + draft: true + labels: "ci" diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3812ee5 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,3 @@ +@Library("devops-jenkins-shared-library@master") _ + +buildOSPackage() From e3638ed54b3ed512d4e917ad470be84332fad927 Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 4 May 2021 15:37:23 +0100 Subject: [PATCH 13/20] Update package handling --- debian/changelog | 9 +++++++++ debian/raspi2png.lintian-overrides | 2 -- debian/rules | 9 +-------- debian/source/format | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index b54542c..bfe36e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +raspi2png (1:0.1-1+nmu1) unstable; urgency=medium + + * Non-maintainer upload. + * Move back to non-native package + * Bump epoch version to allow update path + * Add hardening + + -- pi-top Tue, 04 May 2021 15:35:31 +0100 + raspi2png (0.1+nmu1) unstable; urgency=medium * Non-maintainer upload. diff --git a/debian/raspi2png.lintian-overrides b/debian/raspi2png.lintian-overrides index 2c61965..0059fbd 100644 --- a/debian/raspi2png.lintian-overrides +++ b/debian/raspi2png.lintian-overrides @@ -1,3 +1 @@ raspi2png: no-manual-page usr/bin/raspi2png -raspi2png: hardening-no-bindnow usr/bin/raspi2png -raspi2png: hardening-no-fortify-functions usr/bin/raspi2png diff --git a/debian/rules b/debian/rules index 54429cd..098338c 100755 --- a/debian/rules +++ b/debian/rules @@ -1,12 +1,5 @@ #!/usr/bin/make -f -# See debhelper(7) (uncomment to enable) -# output every command that modifies files on the build system. -#DH_VERBOSE = 1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all -DPKG_EXPORT_BUILDFLAGS = 1 -include /usr/share/dpkg/default.mk - -# main packaging script based on dh7 syntax %: dh $@ - diff --git a/debian/source/format b/debian/source/format index 89ae9db..163aaf8 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (native) +3.0 (quilt) From 7238eaeeceb56120a317ae5170799518d9f31e41 Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Wed, 5 May 2021 14:03:34 +0100 Subject: [PATCH 14/20] Add tar-ignore to debian/source/options --- debian/source/options | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 debian/source/options diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..4cb9b3f --- /dev/null +++ b/debian/source/options @@ -0,0 +1,4 @@ +diff-ignore +tar-ignore +tar-ignore = .github +tar-ignore = Jenkinsfile From 661c02b2b0c0d9fd13bd40f20d8f0ba9b5469e2a Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Wed, 5 May 2021 14:22:00 +0100 Subject: [PATCH 15/20] Drop source/options --- debian/source/options | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 debian/source/options diff --git a/debian/source/options b/debian/source/options deleted file mode 100644 index 4cb9b3f..0000000 --- a/debian/source/options +++ /dev/null @@ -1,4 +0,0 @@ -diff-ignore -tar-ignore -tar-ignore = .github -tar-ignore = Jenkinsfile From 38b28c1bbd74791a43163d5df413f1fd6a3b209a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 09:58:50 -0700 Subject: [PATCH 16/20] [CI] Update debian/changelog for next release (#7) --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index bfe36e2..d77f070 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +raspi2png (1:0.1-1+nmu2) unstable; urgency=medium + + * Update package handling + * Add tar-ignore to debian/source/options + * Drop source/options + + -- pi-top Wed, 05 May 2021 13:22:32 +0000 + raspi2png (1:0.1-1+nmu1) unstable; urgency=medium * Non-maintainer upload. From 1be097d7b4310f8849652c95b98b18d96dd3958d Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Mon, 21 Jun 2021 18:43:45 +0100 Subject: [PATCH 17/20] Use 'multiarch/qemu-user-static:register' --- .github/workflows/build-on-commits-to-master.yml | 4 +++- .github/workflows/build-on-prs-to-master.yml | 4 +++- .github/workflows/create-draft-release-on-chglog-merge.yml | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-on-commits-to-master.yml b/.github/workflows/build-on-commits-to-master.yml index 523f87d..5cc3998 100644 --- a/.github/workflows/build-on-commits-to-master.yml +++ b/.github/workflows/build-on-commits-to-master.yml @@ -27,7 +27,9 @@ jobs: - name: Build Debian package run: | mkdir -p /tmp/artifacts/{src,bin} - docker run --privileged --rm docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 + echo "Package requires emulation - starting multiarch/qemu-user-static" + + docker run --rm --privileged multiarch/qemu-user-static:register --reset docker run --rm \ --volume ${{ github.workspace }}:/src \ --volume /tmp/artifacts/bin:/build \ diff --git a/.github/workflows/build-on-prs-to-master.yml b/.github/workflows/build-on-prs-to-master.yml index a8d2b32..ef4c3da 100644 --- a/.github/workflows/build-on-prs-to-master.yml +++ b/.github/workflows/build-on-prs-to-master.yml @@ -27,7 +27,9 @@ jobs: - name: Build Debian package run: | mkdir -p /tmp/artifacts/{src,bin} - docker run --privileged --rm docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 + echo "Package requires emulation - starting multiarch/qemu-user-static" + + docker run --rm --privileged multiarch/qemu-user-static:register --reset docker run --rm \ --volume ${{ github.workspace }}:/src \ --volume /tmp/artifacts/bin:/build \ diff --git a/.github/workflows/create-draft-release-on-chglog-merge.yml b/.github/workflows/create-draft-release-on-chglog-merge.yml index f824275..9a24ee0 100644 --- a/.github/workflows/create-draft-release-on-chglog-merge.yml +++ b/.github/workflows/create-draft-release-on-chglog-merge.yml @@ -38,7 +38,9 @@ jobs: - name: Build Debian package run: | mkdir -p /tmp/artifacts/{src,bin} - docker run --privileged --rm docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 + echo "Package requires emulation - starting multiarch/qemu-user-static" + + docker run --rm --privileged multiarch/qemu-user-static:register --reset docker run --rm \ --volume ${{ github.workspace }}:/src \ --volume /tmp/artifacts/bin:/build \ From 09c7ae21b684c08d7d745db1bb3f06829171a9ec Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Tue, 22 Jun 2021 11:25:58 +0100 Subject: [PATCH 18/20] Use tonistiigi/binfmt --- .github/workflows/build-on-commits-to-master.yml | 4 ++-- .github/workflows/build-on-prs-to-master.yml | 4 ++-- .github/workflows/create-draft-release-on-chglog-merge.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-on-commits-to-master.yml b/.github/workflows/build-on-commits-to-master.yml index 5cc3998..029ed1f 100644 --- a/.github/workflows/build-on-commits-to-master.yml +++ b/.github/workflows/build-on-commits-to-master.yml @@ -27,9 +27,9 @@ jobs: - name: Build Debian package run: | mkdir -p /tmp/artifacts/{src,bin} - echo "Package requires emulation - starting multiarch/qemu-user-static" + echo "Package requires emulation - starting tonistiigi/binfmt" - docker run --rm --privileged multiarch/qemu-user-static:register --reset + docker run --rm --privileged tonistiigi/binfmt --install all docker run --rm \ --volume ${{ github.workspace }}:/src \ --volume /tmp/artifacts/bin:/build \ diff --git a/.github/workflows/build-on-prs-to-master.yml b/.github/workflows/build-on-prs-to-master.yml index ef4c3da..db27b33 100644 --- a/.github/workflows/build-on-prs-to-master.yml +++ b/.github/workflows/build-on-prs-to-master.yml @@ -27,9 +27,9 @@ jobs: - name: Build Debian package run: | mkdir -p /tmp/artifacts/{src,bin} - echo "Package requires emulation - starting multiarch/qemu-user-static" + echo "Package requires emulation - starting tonistiigi/binfmt" - docker run --rm --privileged multiarch/qemu-user-static:register --reset + docker run --rm --privileged tonistiigi/binfmt --install all docker run --rm \ --volume ${{ github.workspace }}:/src \ --volume /tmp/artifacts/bin:/build \ diff --git a/.github/workflows/create-draft-release-on-chglog-merge.yml b/.github/workflows/create-draft-release-on-chglog-merge.yml index 9a24ee0..dc681e5 100644 --- a/.github/workflows/create-draft-release-on-chglog-merge.yml +++ b/.github/workflows/create-draft-release-on-chglog-merge.yml @@ -38,9 +38,9 @@ jobs: - name: Build Debian package run: | mkdir -p /tmp/artifacts/{src,bin} - echo "Package requires emulation - starting multiarch/qemu-user-static" + echo "Package requires emulation - starting tonistiigi/binfmt" - docker run --rm --privileged multiarch/qemu-user-static:register --reset + docker run --rm --privileged tonistiigi/binfmt --install all docker run --rm \ --volume ${{ github.workspace }}:/src \ --volume /tmp/artifacts/bin:/build \ From ab9342e8682d136d9cf3d67bad26d8c487f8fc91 Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Mon, 5 Jul 2021 11:10:01 +0100 Subject: [PATCH 19/20] Workflow: create draft release manually --- ...log-merge.yml => create-draft-release.yml} | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) rename .github/workflows/{create-draft-release-on-chglog-merge.yml => create-draft-release.yml} (67%) diff --git a/.github/workflows/create-draft-release-on-chglog-merge.yml b/.github/workflows/create-draft-release.yml similarity index 67% rename from .github/workflows/create-draft-release-on-chglog-merge.yml rename to .github/workflows/create-draft-release.yml index dc681e5..407c1eb 100644 --- a/.github/workflows/create-draft-release-on-chglog-merge.yml +++ b/.github/workflows/create-draft-release.yml @@ -1,32 +1,12 @@ name: Create Draft GitHub Release -# Event: Merging Changelog PR (see 'check-should-run') on: - pull_request: - types: [closed] + workflow_dispatch: + branches: + - master jobs: - check-should-run: - runs-on: ubuntu-20.04 - outputs: - should_run: ${{ steps.check_should_run.outputs.should_run }} - steps: - - name: Set 'should run' variable - id: check_should_run - env: - CI_CHANGELOG_BUMP_BRANCH: ${{ secrets.CI_CHANGELOG_BUMP_BRANCH }} - PR_MERGED: ${{ github.event.pull_request.merged }} - run: | - if [[ "${GITHUB_HEAD_REF}" == "${CI_CHANGELOG_BUMP_BRANCH}" ]] && [[ "${PR_MERGED}" == "true" ]]; then - conditions_met="true" - else - conditions_met="false" - fi - echo "::set-output name=should_run::${conditions_met}" - build-debian: - needs: check-should-run - if: needs.check-should-run.outputs.should_run == 'true' runs-on: ubuntu-20.04 steps: - name: GitHub Environment Variables Action @@ -38,14 +18,9 @@ jobs: - name: Build Debian package run: | mkdir -p /tmp/artifacts/{src,bin} - echo "Package requires emulation - starting tonistiigi/binfmt" - - docker run --rm --privileged tonistiigi/binfmt --install all docker run --rm \ --volume ${{ github.workspace }}:/src \ --volume /tmp/artifacts/bin:/build \ - -e LINTIAN_TAGS_TO_SUPPRESS="package-supports-alternative-init-but-no-init.d-script" \ - --platform=linux/arm/v7 \ pitop/deb-build:latest - name: Separate Debian source package files from binary @@ -99,7 +74,6 @@ jobs: name: "v${{ env.VERSION }}" draft: true prerelease: false - body: ${{ secrets.GH_RELEASE_BODY_TEXT }} files: | ./deb/* ./deb-src/* From dff26a61e8233a6afca1bc11a67292bb8be6b534 Mon Sep 17 00:00:00 2001 From: Mike Roberts <2947595+m-roberts@users.noreply.github.com> Date: Fri, 30 Jul 2021 13:26:16 +0100 Subject: [PATCH 20/20] New workflows (#9) --- .../workflows/build-on-commits-to-master.yml | 55 ------------- .github/workflows/build-on-prs-to-master.yml | 55 ------------- .github/workflows/create-draft-release.yml | 81 ------------------- .github/workflows/deb-build.yml | 78 ++++++++++++++++++ .github/workflows/deb-release.yml | 63 +++++++++++++++ .github/workflows/deb-update-changelog.yml | 43 ++++++++++ ...hangelog-draft-pr-on-commits-to-master.yml | 32 -------- 7 files changed, 184 insertions(+), 223 deletions(-) delete mode 100644 .github/workflows/build-on-commits-to-master.yml delete mode 100644 .github/workflows/build-on-prs-to-master.yml delete mode 100644 .github/workflows/create-draft-release.yml create mode 100644 .github/workflows/deb-build.yml create mode 100644 .github/workflows/deb-release.yml create mode 100644 .github/workflows/deb-update-changelog.yml delete mode 100644 .github/workflows/update-changelog-draft-pr-on-commits-to-master.yml diff --git a/.github/workflows/build-on-commits-to-master.yml b/.github/workflows/build-on-commits-to-master.yml deleted file mode 100644 index 029ed1f..0000000 --- a/.github/workflows/build-on-commits-to-master.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Latest Build - -on: - push: - branches: - - master - -jobs: - build-latest-debian-package: - runs-on: ubuntu-20.04 - steps: - - name: GitHub Environment Variables Action - uses: FranzDiebold/github-env-vars-action@v1.2.1 - - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Patch changelog (snapshot) - run: | - docker run --rm \ - --volume ${{ github.workspace }}:/src \ - -e RELEASE=0 \ - pitop/gbp-dch-gen:latest - - - name: Build Debian package - run: | - mkdir -p /tmp/artifacts/{src,bin} - echo "Package requires emulation - starting tonistiigi/binfmt" - - docker run --rm --privileged tonistiigi/binfmt --install all - docker run --rm \ - --volume ${{ github.workspace }}:/src \ - --volume /tmp/artifacts/bin:/build \ - -e LINTIAN_TAGS_TO_SUPPRESS="debian-changelog-line-too-long,spelling-error-in-changelog,unreleased-changelog-distribution" \ - --platform=linux/arm/v7 \ - pitop/deb-build:latest - - - name: Separate Debian source package files from binary - run: | - mv /tmp/artifacts/bin/* /tmp/artifacts/src/ - mv /tmp/artifacts/src/*.deb /tmp/artifacts/bin/ - - - name: Upload Debian source package files - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" - path: "/tmp/artifacts/src/" - - - name: Upload Debian binary packages - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" - path: "/tmp/artifacts/bin/" diff --git a/.github/workflows/build-on-prs-to-master.yml b/.github/workflows/build-on-prs-to-master.yml deleted file mode 100644 index db27b33..0000000 --- a/.github/workflows/build-on-prs-to-master.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: PR Build - -on: - pull_request: - branches: - - master - -jobs: - build-preview-debian-package: - runs-on: ubuntu-20.04 - steps: - - name: GitHub Environment Variables Action - uses: FranzDiebold/github-env-vars-action@v1.2.1 - - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Patch changelog (snapshot) - run: | - docker run --rm \ - --volume ${{ github.workspace }}:/src \ - -e RELEASE=0 \ - pitop/gbp-dch-gen:latest - - - name: Build Debian package - run: | - mkdir -p /tmp/artifacts/{src,bin} - echo "Package requires emulation - starting tonistiigi/binfmt" - - docker run --rm --privileged tonistiigi/binfmt --install all - docker run --rm \ - --volume ${{ github.workspace }}:/src \ - --volume /tmp/artifacts/bin:/build \ - -e LINTIAN_TAGS_TO_SUPPRESS="debian-changelog-line-too-long,spelling-error-in-changelog,unreleased-changelog-distribution" \ - --platform=linux/arm/v7 \ - pitop/deb-build:latest - - - name: Separate Debian source package files from binary - run: | - mv /tmp/artifacts/bin/* /tmp/artifacts/src/ - mv /tmp/artifacts/src/*.deb /tmp/artifacts/bin/ - - - name: Upload Debian source package files - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" - path: "/tmp/artifacts/src/" - - - name: Upload Debian binary packages - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" - path: "/tmp/artifacts/bin/" diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml deleted file mode 100644 index 407c1eb..0000000 --- a/.github/workflows/create-draft-release.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Create Draft GitHub Release - -on: - workflow_dispatch: - branches: - - master - -jobs: - build-debian: - runs-on: ubuntu-20.04 - steps: - - name: GitHub Environment Variables Action - uses: FranzDiebold/github-env-vars-action@v1.2.1 - - - name: Checkout code - uses: actions/checkout@v2.2.0 - - - name: Build Debian package - run: | - mkdir -p /tmp/artifacts/{src,bin} - docker run --rm \ - --volume ${{ github.workspace }}:/src \ - --volume /tmp/artifacts/bin:/build \ - pitop/deb-build:latest - - - name: Separate Debian source package files from binary - run: | - mv /tmp/artifacts/bin/* /tmp/artifacts/src/ - mv /tmp/artifacts/src/*.deb /tmp/artifacts/bin/ - - - name: Upload Debian source package files - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" - path: "/tmp/artifacts/src/" - - - name: Upload Debian binary packages - uses: actions/upload-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" - path: "/tmp/artifacts/bin/" - - create-draft-release: - runs-on: ubuntu-20.04 - needs: build-debian - steps: - - name: GitHub Environment Variables Action - uses: FranzDiebold/github-env-vars-action@v1.2.1 - - - name: Checkout code - uses: actions/checkout@v2.2.0 - - - name: Download Debian binary artifacts - uses: actions/download-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb" - path: "./deb/" - - - name: Download Debian source artifacts - uses: actions/download-artifact@v2 - with: - name: "${{ env.GITHUB_REPOSITORY_NAME }}-#${{ env.GITHUB_SHA_SHORT }}-deb-src" - path: "./deb-src/" - - - name: Determine version - run: | - sudo apt install -y dpkg-dev - echo "VERSION=$(dpkg-parsechangelog -Sversion)" >> $GITHUB_ENV - - - name: Create Release - uses: softprops/action-gh-release@v1 - with: - tag_name: "v${{ env.VERSION }}" - name: "v${{ env.VERSION }}" - draft: true - prerelease: false - files: | - ./deb/* - ./deb-src/* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deb-build.yml b/.github/workflows/deb-build.yml new file mode 100644 index 0000000..61b2c8f --- /dev/null +++ b/.github/workflows/deb-build.yml @@ -0,0 +1,78 @@ +name: Debian Package Build + +on: + pull_request: + branches: + - master + push: + branches: + - master + +env: + DEB_BUILD_DOCKER_IMAGE: "pitop/pi-top-os-deb-build" + DEB_BUILD_DOCKER_TAG: "latest" + CHANGELOG_AUTHOR_NAME: "pi-top" + CHANGELOG_AUTHOR_EMAIL: "deb-maintainers@pi-top.com" + +jobs: + build-debian-package: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2.2.0 + + - id: version + uses: docker://lpenz/ghaction-version-gen:0.3 + + - name: Add changelog entry for latest snapshot version + uses: pi-top/git-debian-changelog-bump-action@master + with: + release: false + author_name: ${{ env.CHANGELOG_AUTHOR_NAME }} + author_email: ${{ env.CHANGELOG_AUTHOR_EMAIL }} + snapshot_number: ${{ steps.version.outputs.distance }} + since: ${{ steps.version.outputs.tag_latest }} + + # We only want ARM builds. This step is here to provide the option of + # using a strategy matrix if additional builds (e.g. `arm64`) are desired + - name: Determine architecture to use from package info + # If architecture is 'all', then it can be compiled on host architecture + # All other pi-topOS cases require 'armhf' + run: | + target_architecture=amd64 + if grep '^Architecture:' debian/control | grep -q -v 'all'; then + target_architecture=armhf + fi + echo "TARGET_ARCHITECTURE=${target_architecture}" >> $GITHUB_ENV + + - name: Build Debian package + uses: pi-top/debian-package-build-action@master + with: + target_architecture: ${{ env.TARGET_ARCHITECTURE }} + docker_image: ${{ env.DEB_BUILD_DOCKER_IMAGE }}:${{ env.DEB_BUILD_DOCKER_TAG }} + build_directory: ./artifacts + + - name: Generate artifact name + run: | + echo "ARTIFACT_PREFIX=$(basename -s .dsc "$(find . -name "*.dsc")")" >> $GITHUB_ENV + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARTIFACT_PREFIX }}.deb + path: ./artifacts/*.deb + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARTIFACT_PREFIX }}.deb-src + path: ./artifacts/*.tar.xz + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARTIFACT_PREFIX }}.metadata + path: | + ./artifacts/** + !./artifacts/*.deb + !./artifacts/*.tar.xz diff --git a/.github/workflows/deb-release.yml b/.github/workflows/deb-release.yml new file mode 100644 index 0000000..aba35e8 --- /dev/null +++ b/.github/workflows/deb-release.yml @@ -0,0 +1,63 @@ +name: Create GitHub Release + +on: + workflow_dispatch: + branches: + - master + +env: + DEB_BUILD_DOCKER_IMAGE: "pitop/pi-top-os-deb-build" + DEB_BUILD_DOCKER_TAG: "latest" + +jobs: + release: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2.2.0 + + - id: version + uses: docker://lpenz/ghaction-version-gen:0.3 + + - name: Determine current and last tagged versions + run: | + sudo apt install -y dpkg-dev + echo "CURRENT_VERSION=$(dpkg-parsechangelog -Sversion)" >> $GITHUB_ENV + + - name: Confirm version is higher than last tagged version + if: steps.version.outputs.tag_latest != "" + run: dpkg --compare-versions ${{ env.CURRENT_VERSION }} gt ${{ steps.version.outputs.tag_latest }} + + - name: Determine architecture to use from package info + # If architecture is 'all', then it can be compiled on host architecture + # All other pi-topOS cases require 'armhf' + run: | + target_architecture=amd64 + if grep '^Architecture:' debian/control | grep -q -v 'all'; then + target_architecture=armhf + fi + echo "TARGET_ARCHITECTURE=${target_architecture}" >> $GITHUB_ENV + + - name: Build Debian package + uses: pi-top/debian-package-build-action@master + with: + target_architecture: ${{ env.TARGET_ARCHITECTURE }} + docker_image: ${{ env.DEB_BUILD_DOCKER_IMAGE }}:${{ env.DEB_BUILD_DOCKER_TAG }} + build_directory: ./artifacts + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: "dsc" + path: "./artifacts" + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + tag_name: "v${{ env.CURRENT_VERSION }}" + name: "v${{ env.CURRENT_VERSION }}" + draft: false + prerelease: false + files: ./artifacts/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deb-update-changelog.yml b/.github/workflows/deb-update-changelog.yml new file mode 100644 index 0000000..8faf8d2 --- /dev/null +++ b/.github/workflows/deb-update-changelog.yml @@ -0,0 +1,43 @@ +name: Update Debian Package Changelog + +on: + workflow_dispatch: + branches: + - master + +env: + CHANGELOG_AUTHOR_NAME: "pi-top" + CHANGELOG_AUTHOR_EMAIL: "deb-maintainers@pi-top.com" + COMMIT_MESSAGE_PREFIX: "New changelog entry: v" + +jobs: + commit-updated-changelog: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2.2.0 + + - id: version + uses: docker://lpenz/ghaction-version-gen:0.3 + + - name: Add changelog entry for release version + uses: pi-top/git-debian-changelog-bump-action@master + with: + release: true + author_name: ${{ env.CHANGELOG_AUTHOR_NAME }} + author_email: ${{ env.CHANGELOG_AUTHOR_EMAIL }} + snapshot_number: ${{ steps.version.outputs.distance }} + since: ${{ steps.version.outputs.tag_latest }} + # Don't include previous changelog version bump commits in changelog + ignore_regex: | + ${{ env. COMMIT_MESSAGE_PREFIX }} + + - name: Determine current version + run: | + sudo apt install -y dpkg-dev + echo "CURRENT_VERSION=$(dpkg-parsechangelog -Sversion)" >> $GITHUB_ENV + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "${{ env.COMMIT_MESSAGE_PREFIX }}${{ env.CURRENT_VERSION }}" + branch: master diff --git a/.github/workflows/update-changelog-draft-pr-on-commits-to-master.yml b/.github/workflows/update-changelog-draft-pr-on-commits-to-master.yml deleted file mode 100644 index 05c9b06..0000000 --- a/.github/workflows/update-changelog-draft-pr-on-commits-to-master.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Update Changelog Draft PR - -on: - push: - branches: - - master - -jobs: - create-version-update-changelog-pr: - runs-on: ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v2.2.0 - with: - fetch-depth: 0 - - - name: Patch changelog (release) - run: | - docker run --rm \ - --volume ${{ github.workspace }}:/src \ - -e RELEASE=1 \ - pitop/gbp-dch-gen:latest - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - with: - branch: ${{ secrets.CI_CHANGELOG_BUMP_BRANCH }} - commit-message: ${{ secrets.CI_CHANGELOG_BUMP_COMMIT_MESSAGE }} - title: ${{ secrets.CI_CHANGELOG_BUMP_TITLE }} - body: ${{ secrets.CI_CHANGELOG_BUMP_BODY }} - draft: true - labels: "ci"