Skip to content

Commit bb5aba5

Browse files
committed
Add semver handling
1 parent 211aed8 commit bb5aba5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ jobs:
128128
else
129129
echo "prefix=gitmastery" >> $GITHUB_OUTPUT
130130
fi
131+
DEBIAN_VERSION=$(echo "${VERSION}" | sed 's/-beta\./~beta/g')
132+
echo "debian_version=$DEBIAN_VERSION" >> $GITHUB_OUTPUT
131133
132134
- name: Create folder structure for ${{ env.ARCHITECTURE }} distribution
133135
run: |
@@ -142,7 +144,7 @@ jobs:
142144
- name: Create upstream tarball .orig.tar.gz
143145
run: |
144146
# Create .orig.tar.gz file
145-
tar -czf ${{ steps.pkg.outputs.prefix }}_${VERSION}.orig.tar.gz ${{ steps.pkg.outputs.prefix }}-${VERSION}-${ARCHITECTURE}/${{ steps.pkg.outputs.prefix }}-${VERSION}-linux-${ARCHITECTURE}
147+
tar -czf ${{ steps.pkg.outputs.prefix }}_${{ steps.pkg.outputs.debian_version }}.orig.tar.gz ${{ steps.pkg.outputs.prefix }}-${VERSION}-${ARCHITECTURE}/${{ steps.pkg.outputs.prefix }}-${VERSION}-linux-${ARCHITECTURE}
146148
147149
- name: Generate Debian packaging files
148150
working-directory: ${{ steps.pkg.outputs.prefix }}-${{ env.VERSION }}-${{ env.ARCHITECTURE }}
@@ -158,7 +160,10 @@ jobs:
158160
159161
# Generate the changelog
160162
# TODO: Maybe detect if major version change, then make it urgent
161-
dch --create -v ${VERSION}-1 -u low --package ${PKG} "$CHANGELOG_MESSAGE"
163+
164+
# Changing -beta. to ~beta for Debian semver handling
165+
DEBIAN_VERSION=$(echo "${VERSION}" | sed 's/-beta\./~beta/g')
166+
dch --create -v ${DEBIAN_VERSION}-1 -u low --package ${PKG} "$CHANGELOG_MESSAGE"
162167
163168
# Create the control file
164169
# TODO: Maybe detect if major version change, then make it mandatory
@@ -209,7 +214,7 @@ jobs:
209214
- name: Create GitHub Release
210215
uses: softprops/action-gh-release@v2
211216
with:
212-
files: ${{ steps.pkg.outputs.prefix }}_${{ env.VERSION }}-1_${{ env.ARCHITECTURE }}.deb
217+
files: ${{ steps.pkg.outputs.prefix }}_${{ steps.pkg.outputs.debian_version }}-1_${{ env.ARCHITECTURE }}.deb
213218
tag_name: ${{ needs.prepare.outputs.ref_name }}
214219
prerelease: ${{ contains(needs.prepare.outputs.ref_name, 'beta') }}
215220
env:
@@ -355,14 +360,15 @@ jobs:
355360
356361
BINARY_NAME=${AUR_PKG}-${VERSION}-linux-${ARCHITECTURE}
357362
RELEASE_AMD64_URL="https://github.com/git-mastery/app/releases/download/${REF_NAME}/${BINARY_NAME}"
363+
PKGVER=$(echo "$REF_NAME" | sed 's/-/_/g') # pkgver cannot have a hyphen (handles beta tags)
358364
359365
echo -e $"""$CHANGELOG_MESSAGE
360366
\n""" >> gitmastery.changelog
361367
cat gitmastery.changelog
362368
363369
echo """# Maintainer: Jiahao, Woo <woojiahao1234@gmail.com>
364370
pkgname=${AUR_PKG}
365-
pkgver=\"$REF_NAME\"
371+
pkgver=\"$PKGVER\"
366372
pkgrel=1
367373
pkgdesc=\"Git-Mastery CLI for practicing Git\"
368374
arch=('x86_64')

0 commit comments

Comments
 (0)