ci: gate release publishing to final tags, upstream-shape the tarball
RC tags (a v* tag with a prerelease suffix) now publish nothing at all — the release job joins the crates.io job behind the same gate; only final release tags attach artifacts. The tarball loses the 'orig' qualifier: 'orig' is the Debian side's name for the imported upstream tarball (gbp/uscan rename it on import), not something upstream ships. The asset is pkh-<version>.tar.gz over a versioned pkh-<version>/ prefix, the conventional upstream shape.
This commit is contained in:
+18
-17
@@ -124,14 +124,17 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
release:
|
release:
|
||||||
# Publishes the release artifacts on a v* tag: the Debian orig
|
# Publishes the release artifacts on a release tag (a v* tag without
|
||||||
# tarball, the packed snap, and their checksums. Gitea's automatic
|
# a prerelease suffix — RC tags publish nothing, like the crates.io
|
||||||
# per-tag archive is a git-tree snapshot named after the raw tag —
|
# job): the upstream tarball, the packed snap, and their checksums.
|
||||||
# not a dpkg-shaped orig (the version must not carry a hyphen; the
|
# Gitea's automatic per-tag archive is a git-tree snapshot named
|
||||||
# Debian encoding of a prerelease is 0.2.0~rc1). Nothing is
|
# after the raw tag; this produces the conventional upstream shape
|
||||||
# published beyond this repo's release page: no crates.io (see the
|
# (pkh-<version>.tar.gz, versioned pkh-<version>/ prefix) attached
|
||||||
# publish job), no snap store.
|
# to a release page. Nothing is published beyond this repo: no
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
# crates.io (see the publish job), no snap store. The Debian
|
||||||
|
# packaging renames the tarball to .orig.tar.gz on import, as
|
||||||
|
# gbp/uscan always do for upstream releases.
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-')
|
||||||
needs: [build, snap]
|
needs: [build, snap]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
@@ -146,22 +149,20 @@ jobs:
|
|||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: snap
|
name: snap
|
||||||
- name: Build the orig tarball
|
- name: Build the upstream tarball
|
||||||
run: |
|
run: |
|
||||||
tag="${GITHUB_REF_NAME#v}"
|
tag="${GITHUB_REF_NAME#v}"
|
||||||
debver="${tag/-/~}"
|
git archive --format=tar.gz --prefix="pkh-${tag}/" \
|
||||||
git archive --format=tar.gz --prefix="pkh-${debver}/" \
|
-o "pkh-${tag}.tar.gz" HEAD
|
||||||
-o "pkh_${debver}.orig.tar.gz" HEAD
|
sha256sum "pkh-${tag}.tar.gz" pkh_*_amd64.snap > sha256sums.txt
|
||||||
sha256sum pkh_${debver}.orig.tar.gz pkh_*_amd64.snap > sha256sums.txt
|
|
||||||
- name: Create or get the release
|
- name: Create or get the release
|
||||||
id: release
|
id: release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
||||||
tag="$GITHUB_REF_NAME"
|
tag="${GITHUB_REF_NAME#v}"
|
||||||
case "$tag" in *-*) pre=true;; *) pre=false;; esac
|
body="{\"tag_name\":\"$GITHUB_REF_NAME\",\"name\":\"pkh $tag\",\"body\":\"Release artifacts for $tag: the source tarball, the packed snap and their checksums.\",\"draft\":false,\"prerelease\":false}"
|
||||||
body="{\"tag_name\":\"$tag\",\"name\":\"pkh $tag\",\"body\":\"Release artifacts for $tag: the Debian orig tarball, the packed snap and their checksums.\",\"draft\":false,\"prerelease\":$pre}"
|
|
||||||
release_id=$(curl -sf -X POST \
|
release_id=$(curl -sf -X POST \
|
||||||
-H "Authorization: token $GITHUB_TOKEN" \
|
-H "Authorization: token $GITHUB_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
@@ -180,7 +181,7 @@ jobs:
|
|||||||
RELEASE_ID: ${{ steps.release.outputs.release_id }}
|
RELEASE_ID: ${{ steps.release.outputs.release_id }}
|
||||||
run: |
|
run: |
|
||||||
api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
||||||
for f in pkh_*.orig.tar.gz pkh_*_amd64.snap sha256sums.txt; do
|
for f in pkh-*.tar.gz pkh_*_amd64.snap sha256sums.txt; do
|
||||||
echo "attaching $f"
|
echo "attaching $f"
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
-H "Authorization: token $GITHUB_TOKEN" \
|
-H "Authorization: token $GITHUB_TOKEN" \
|
||||||
|
|||||||
Reference in New Issue
Block a user