From f8f462b7b423375e589df3409909b61ee7c89fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=20Lin=29?= Date: Mon, 30 Oct 2023 03:27:53 +0800 Subject: [PATCH] feat: Implement GitHub release publishing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 林博仁(Buo-ren Lin) --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9b45800 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +# Release product and their build aritfacts +# +# References: +# +# * Workflow syntax for GitHub Actions - GitHub Docs +# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions +# +# Copyright 2023 林博仁(Buo-ren, Lin) +# SPDX-License-Identifier: CC-BY-SA-4.0 +name: Release product and their build aritfacts +on: + push: + tags: + - v*.*.* + +jobs: + release: + name: Release product and their build aritfacts + runs-on: ubuntu-20.04 + steps: + - name: Checkout content from the Git repository + uses: actions/checkout@v4 + + - name: Determine the project identifier + run: printf "project_id=${GITHUB_REPOSITORY##*/}\\n" >> $GITHUB_ENV + + - name: Determine the name of the Git tag + run: printf "release_tag=${GITHUB_REF##*/}\\n" >> $GITHUB_ENV + + - name: Determine the release version string + run: printf "release_version=${release_tag#v}\\n" >> $GITHUB_ENV + + - name: Determine the release identifier + run: printf "release_id=${project_id}-${release_version}\\n" >> $GITHUB_ENV + + - name: Generate the release archive + run: >- + git archive + --prefix="${release_id}/" + --output="${release_id}.tar.gz" + "${release_tag}" + + - name: Publish the release archive to the GitHub Releases + uses: softprops/action-gh-release@v0.1.15 + with: + name: ${{ env.project_id }} ${{ env.release_version }} + files: | + ${{ env.release_id }}.tar*