test: one-off backfill workflow for historical releases (not for main)
This commit is contained in:
1 parent
7aa11b0396
commit
4b9924ffff
1 file changed
+81
@@ -0,0 +1,81 @@
|
||||
name: backfill-release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Existing tag to backfill a release for (e.g. v0.0.1)'
|
||||
required: true
|
||||
|
||||
env:
|
||||
SERVER_URL: https://git.arthurerlich.de
|
||||
|
||||
jobs:
|
||||
backfill:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.tag }}
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.RELEASE_TOKEN }}
|
||||
|
||||
- name: Extract changelog section for this version (fallback to Unreleased)
|
||||
run: |
|
||||
VER="${{ inputs.tag }}"
|
||||
VER="${VER#v}"
|
||||
awk -v ver="$VER" '
|
||||
BEGIN { found=0 }
|
||||
/^## \[/ {
|
||||
if (found) exit
|
||||
if ($0 ~ "\[" ver "\]") { found=1; next }
|
||||
}
|
||||
found { print }
|
||||
' CHANGELOG.md > release-notes.md
|
||||
if [ ! -s release-notes.md ]; then
|
||||
awk '
|
||||
BEGIN { found=0 }
|
||||
/^## \[Unreleased\]/ { found=1; next }
|
||||
/^## \[/ { if (found) exit }
|
||||
found { print }
|
||||
' CHANGELOG.md > release-notes.md
|
||||
fi
|
||||
cat release-notes.md
|
||||
|
||||
- name: Install shopware-cli
|
||||
run: |
|
||||
curl -sL -o /tmp/shopware-cli.tar.gz \
|
||||
https://github.com/shopware/shopware-cli/releases/latest/download/shopware-cli_Linux_x86_64.tar.gz
|
||||
mkdir -p /tmp/swcli-extract
|
||||
tar -xzf /tmp/shopware-cli.tar.gz -C /tmp/swcli-extract
|
||||
cp /tmp/swcli-extract/shopware-cli /usr/local/bin/shopware-cli
|
||||
|
||||
- name: Package Store-style zip
|
||||
run: |
|
||||
shopware-cli extension package . --output-directory .build \
|
||||
--filename "AeonDumpManager-${{ inputs.tag }}.zip"
|
||||
|
||||
- name: Build root-level zip for the Composer registry
|
||||
run: git archive --format=zip -o "composer-package-${{ inputs.tag }}.zip" "${{ inputs.tag }}"
|
||||
|
||||
- name: Create Gitea Release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
server_url: ${{ env.SERVER_URL }}
|
||||
token: ${{ secrets.RELEASE_TOKEN }}
|
||||
tag_name: ${{ inputs.tag }}
|
||||
name: ${{ inputs.tag }}
|
||||
body_path: release-notes.md
|
||||
files: .build/AeonDumpManager-${{ inputs.tag }}.zip
|
||||
|
||||
- name: Publish to Composer registry
|
||||
run: |
|
||||
STATUS=$(curl -s -o /tmp/composer-publish.log -w "%{http_code}" \
|
||||
-u "haylan:${{ secrets.RELEASE_TOKEN }}" \
|
||||
-T "composer-package-${{ inputs.tag }}.zip" \
|
||||
"https://git.arthurerlich.de/api/packages/haylan/composer")
|
||||
cat /tmp/composer-publish.log
|
||||
if [ "$STATUS" != "201" ] && [ "$STATUS" != "409" ]; then
|
||||
echo "Unexpected HTTP status $STATUS publishing to the Composer registry"
|
||||
exit 1
|
||||
fi
|
||||
Reference in new issue
Block a user