]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
github: automatically publish a release
authorVincent Bernat <vincent@bernat.ch>
Mon, 21 Jun 2021 23:29:52 +0000 (01:29 +0200)
committerVincent Bernat <vincent@bernat.ch>
Mon, 21 Jun 2021 23:42:05 +0000 (01:42 +0200)
.github/workflows/ci.yml
tests/ci/release.sh [new file with mode: 0755]

index 1c5bf79fe5764be0d19510f054bdcbbd44e66836..470d3a1917ada74371770c7e8336ecde0210e22e 100644 (file)
@@ -54,6 +54,9 @@ jobs:
         env:
           LLDPD_CONFIG_ARGS: ${{ matrix.config-args }}
           CC: ${{ matrix.compiler }}
+      - name: Generate release body
+        if: matrix.release && matrix.os == 'ubuntu-latest'
+        run: ./tests/ci/release.sh > release.md
       - name: Upload release tarball
         uses: actions/upload-artifact@v2
         if: matrix.release && matrix.os == 'ubuntu-latest'
@@ -68,6 +71,14 @@ jobs:
           name: package
           path: lldpd-*.pkg
           if-no-files-found: error
+      - name: Upload release summary
+        uses: actions/upload-artifact@v2
+        if: matrix.release && matrix.os == 'ubuntu-latest'
+        with:
+          name: release
+          path: release.md
+          if-no-files-found: error
+
   docker:
     needs: build
     runs-on: ubuntu-latest
@@ -104,3 +115,31 @@ jobs:
           push: true
           tags: ${{ steps.meta.outputs.tags }}
           labels: ${{ steps.meta.outputs.labels }}
+
+  release:
+    needs: build
+    runs-on: ubuntu-latest
+    name: Publish release
+    if: startsWith(github.ref, 'refs/tags/')
+    jobs:
+      - name: Download TGZ tarball
+        uses: actions/download-artifact@v2
+        with:
+          name: tarball
+      - name: Download MacOS package
+        uses: actions/download-artifact@v2
+        with:
+          name: package
+      - name: Download release text
+        uses: actions/download-artifact@v2
+        with:
+          name: release
+      - name: Publish release
+        uses: softprops/action-gh-release@v1
+        with:
+          body_path: release.md
+          files: |
+            *.tar.gz
+            *.pkg
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/tests/ci/release.sh b/tests/ci/release.sh
new file mode 100755 (executable)
index 0000000..e53b393
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+echo "## Summary"
+sed -n '2,/^$/p' NEWS
+
+echo "## Changelog"
+sed -n '3,/^$/p' ChangeLog