|
| 1 | +# Release product and their build aritfacts |
| 2 | +# |
| 3 | +# References: |
| 4 | +# |
| 5 | +# * Workflow syntax for GitHub Actions - GitHub Docs |
| 6 | +# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions |
| 7 | +# |
| 8 | +# Copyright 2024 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com> |
| 9 | +# SPDX-License-Identifier: CC-BY-SA-4.0 |
| 10 | +name: Release product and their build aritfacts |
| 11 | +on: |
| 12 | + push: |
| 13 | + tags: |
| 14 | + - v*.*.* |
| 15 | + |
| 16 | +jobs: |
| 17 | + release: |
| 18 | + name: Release product and their build aritfacts |
| 19 | + runs-on: ubuntu-20.04 |
| 20 | + steps: |
| 21 | + - name: Check out content from the Git repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + # Increase fetch depth if you may have more than this amount |
| 25 | + # of revisions between releases |
| 26 | + fetch-depth: 100 |
| 27 | + |
| 28 | + # Fetch tags as well to generate detailed changes between two releases |
| 29 | + # WORKAROUND: Adding this option triggers actions/checkout#1467 |
| 30 | + #fetch-tags: true |
| 31 | + |
| 32 | + # Also recursively fetch submodules |
| 33 | + # WORKAROUND: Adding this option triggers actions/checkout#1959 |
| 34 | + #submodules: true |
| 35 | + |
| 36 | + - name: >- |
| 37 | + WORKAROUND: Fetch tags that points to the revisions |
| 38 | + checked-out(actions/checkout#1467) |
| 39 | + run: |- |
| 40 | + git fetch \ |
| 41 | + --prune \ |
| 42 | + --prune-tags \ |
| 43 | + --force \ |
| 44 | + --depth=100 \ |
| 45 | + --no-recurse-submodules |
| 46 | +
|
| 47 | + - name: >- |
| 48 | + WORKAROUND: Checkout submodules recursively(actions/checkout#1959) |
| 49 | + run: |- |
| 50 | + git submodule update \ |
| 51 | + --init \ |
| 52 | + --recursive \ |
| 53 | + --depth 1 |
| 54 | +
|
| 55 | + - name: Determine the project identifier |
| 56 | + run: printf "project_id=${GITHUB_REPOSITORY##*/}\\n" >> $GITHUB_ENV |
| 57 | + |
| 58 | + - name: Determine the name of the Git tag |
| 59 | + run: printf "release_tag=${GITHUB_REF##*/}\\n" >> $GITHUB_ENV |
| 60 | + |
| 61 | + - name: Determine the release version string |
| 62 | + run: printf "release_version=${release_tag#v}\\n" >> $GITHUB_ENV |
| 63 | + |
| 64 | + - name: Determine the release identifier |
| 65 | + run: printf "release_id=${project_id}-${release_version}\\n" >> $GITHUB_ENV |
| 66 | + |
| 67 | + - name: >- |
| 68 | + Patch the sudo security policy so that programs run via sudo |
| 69 | + will recognize environment variables predefined by GitHub |
| 70 | + run: sudo ./continuous-integration/patch-github-actions-sudo-security-policy.sh |
| 71 | +
|
| 72 | + - name: Generate the release archive |
| 73 | + run: |- |
| 74 | + sudo ./continuous-integration/generate-build-artifacts.install-system-deps.sh |
| 75 | + ./continuous-integration/generate-build-artifacts.sh |
| 76 | +
|
| 77 | + - name: Generate the release description |
| 78 | + run: ./continuous-integration/generate-release-description.sh |
| 79 | + |
| 80 | + - name: Publish the release archive to the GitHub Releases |
| 81 | + uses: softprops/action-gh-release@v2 |
| 82 | + with: |
| 83 | + name: ${{ env.project_id }} ${{ env.release_version }} |
| 84 | + files: | |
| 85 | + ${{ env.release_id }}.tar* |
| 86 | + body_path: .detailed_changes |
0 commit comments