From 9b69a02647ae11ada7d013aba61cc1bc220f508a 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 | 18 +++++++++--------- .github/workflows/ci.yaml | 12 ++++++++++++ .github/workflows/tag.yaml | 29 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 9 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..6238855 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,29 +1,29 @@ -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 + - uses: actions/checkout@v4 - name: deps run: | 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 + uses: actions/upload-artifact@v4 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..9ddea71 --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,29 @@ +name: Tag + +permissions: + contents: write + +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