@@ -687,3 +687,99 @@ jobs:
687
687
name : deb-package-signed
688
688
path : signed
689
689
# End build & sign Ubuntu package
690
+
691
+ create-github-release :
692
+ runs-on : ubuntu-latest
693
+ needs : [prereqs, windows_artifacts, osx_publish_dmg, ubuntu_sign-artifacts]
694
+ if : |
695
+ success() ||
696
+ (needs.ubuntu_sign-artifacts.result == 'skipped' &&
697
+ needs.osx_publish_dmg.result == 'success' &&
698
+ needs.windows_artifacts.result == 'success')
699
+ steps :
700
+ - name : Download Windows portable installer
701
+ uses : actions/download-artifact@v3
702
+ with :
703
+ name : win-portable-x86_64
704
+ path : win-portable-x86_64
705
+ - name : Download Windows x86_64 installer
706
+ uses : actions/download-artifact@v3
707
+ with :
708
+ name : win-installer-x86_64
709
+ path : win-installer-x86_64
710
+ - name : Download Mac dmg
711
+ uses : actions/download-artifact@v3
712
+ with :
713
+ name : osx-dmg
714
+ path : osx-dmg
715
+ - name : Download Mac pkg
716
+ uses : actions/download-artifact@v3
717
+ with :
718
+ name : osx-signed-pkg
719
+ path : osx-pkg
720
+ - name : Download Ubuntu package (signed)
721
+ if : needs.prereqs.outputs.deb_signable == 'true'
722
+ uses : actions/download-artifact@v3
723
+ with :
724
+ name : deb-package-signed
725
+ path : deb-package
726
+ - name : Download Ubuntu package (unsigned)
727
+ if : needs.prereqs.outputs.deb_signable != 'true'
728
+ uses : actions/download-artifact@v3
729
+ with :
730
+ name : deb-package-unsigned
731
+ path : deb-package
732
+ - uses : actions/github-script@v6
733
+ with :
734
+ script : |
735
+ const fs = require('fs');
736
+ const path = require('path');
737
+
738
+ var releaseMetadata = {
739
+ owner: context.repo.owner,
740
+ repo: context.repo.repo
741
+ };
742
+
743
+ // Create the release
744
+ var tagName = "${{ needs.prereqs.outputs.tag_name }}";
745
+ var createdRelease = await github.rest.repos.createRelease({
746
+ ...releaseMetadata,
747
+ draft: true,
748
+ tag_name: tagName,
749
+ name: tagName
750
+ });
751
+ releaseMetadata.release_id = createdRelease.data.id;
752
+
753
+ // Uploads contents of directory to the release created above
754
+ async function uploadDirectoryToRelease(directory, includeExtensions=[]) {
755
+ return fs.promises.readdir(directory)
756
+ .then(async(files) => Promise.all(
757
+ files.filter(file => {
758
+ return includeExtensions.length==0 || includeExtensions.includes(path.extname(file).toLowerCase());
759
+ })
760
+ .map(async (file) => {
761
+ var filePath = path.join(directory, file);
762
+ github.rest.repos.uploadReleaseAsset({
763
+ ...releaseMetadata,
764
+ name: file,
765
+ headers: {
766
+ "content-length": (await fs.promises.stat(filePath)).size
767
+ },
768
+ data: fs.createReadStream(filePath)
769
+ });
770
+ }))
771
+ );
772
+ }
773
+
774
+ await Promise.all([
775
+ // Upload Windows artifacts
776
+ uploadDirectoryToRelease('win-installer-x86_64', ['.exe']),
777
+ uploadDirectoryToRelease('win-portable-x86_64', ['.exe']),
778
+
779
+ // Upload Mac artifacts
780
+ uploadDirectoryToRelease('osx-dmg'),
781
+ uploadDirectoryToRelease('osx-pkg'),
782
+
783
+ // Upload Ubuntu artifacts
784
+ uploadDirectoryToRelease('deb-package')
785
+ ]);
0 commit comments