From 6dcab64688069c71d0f543a1071c8d6448dfc518 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Sun, 21 Jan 2024 20:38:41 -0600 Subject: [PATCH] trivial: Add a workflow for automatically releasing a binary on tag event --- .github/workflows/build.yaml | 14 +++++++------- .github/workflows/ci.yaml | 12 ++++++++++++ .github/workflows/tag.yaml | 26 ++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/tag.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index abbe296..d7f3589 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,14 +1,12 @@ -name: build - +name: Build Workflow on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + workflow_call: jobs: build: runs-on: ubuntu-latest + outputs: + deb: ${{ steps.package.outputs.deb }} steps: - uses: actions/checkout@v2 - name: deps @@ -16,14 +14,16 @@ jobs: sudo apt update sudo apt install debhelper dpkg-dev -y - name: package + id: package run: | mkdir -p tmp cd tmp && \ ln -s ../fwupd-wrapper ../debian . && \ dpkg-buildpackage -us -uc + echo "deb=$(ls *.deb)" >> $GITHUB_OUTPUT - name: Capture artifacts uses: actions/upload-artifact@v3 with: - name: debian package + name: debian path: | *.deb diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..0205194 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,12 @@ +name: build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + ci: + uses: ./.github/workflows/build.yaml + secrets: inherit diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml new file mode 100644 index 0000000..e124a27 --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,26 @@ +name: Tag + +on: + push: + tags: + - '*' + +jobs: + build: + uses: ./.github/workflows/build.yml + secrets: inherit + + tag: + name: Tag Release + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + id: download + with: + name: debian + + - name: Release the Package + uses: softprops/action-gh-release@v1 + with: + files: ${{ needs.build.outputs.deb }} \ No newline at end of file