Skip to content

Commit

Permalink
feat: ci: avoid unnecessary release steps
Browse files Browse the repository at this point in the history
Signed-off-by: ZHANG Yuntian <yt@radxa.com>
  • Loading branch information
RadxaYuntian committed Mar 8, 2024
1 parent 903e294 commit 0cdc1bb
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
outputs:
distro: ${{ steps.distro_check.outputs.distro }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -47,10 +49,20 @@ jobs:
path: |
${{ env.artifacts_path }}/*.deb
src/packages/arm64/**/*.deb
- name: Check if the latest version is releasable
id: distro_check
run: |
version="$(dpkg-parsechangelog -S Version)"
if [[ -n "$(git tag -l "$version")" ]]
then
echo "distro=UNRELEASED" >> "$GITHUB_OUTPUT"
else
echo "distro=$(dpkg-parsechangelog -S Distribution)" >> "$GITHUB_OUTPUT"
fi
release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' }}
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' && needs.build.outputs.distro != 'UNRELEASED' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -70,19 +82,12 @@ jobs:
echo "$(dpkg-parsechangelog -S Changes)" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
if [[ -n "$(git tag -l "$version")" ]]
then
echo "distro=UNRELEASED" >> $GITHUB_ENV
else
echo "distro=$(dpkg-parsechangelog -S Distribution)" >> $GITHUB_ENV
fi
echo "$version" > VERSION
if [[ -f pkg.conf.template ]]
then
sed "s/VERSION/$(dpkg-parsechangelog -S Version)/g" pkg.conf.template > pkg.conf
fi
- name: Release
if: env.distro != 'UNRELEASED'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.version }}
Expand All @@ -96,7 +101,6 @@ jobs:
pkg.conf
VERSION
- name: Append changelog
if: env.distro != 'UNRELEASED'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.version }}
Expand All @@ -105,7 +109,6 @@ jobs:
${{ env.changes }}
append_body: true
- name: Update Test repos
if: env.distro != 'UNRELEASED'
uses: radxa-repo/update-repo-action@main
with:
test-repo: true
Expand Down

0 comments on commit 0cdc1bb

Please sign in to comment.