mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
gh: use workflow_run trigger for copr
This commit is contained in:
28
.github/workflows/copr-release.yml
vendored
28
.github/workflows/copr-release.yml
vendored
@@ -1,11 +1,10 @@
|
|||||||
name: DMS Copr Stable Release
|
name: DMS Copr Stable Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_run:
|
||||||
tags:
|
workflows: ["Create Release from DMS"]
|
||||||
- 'v*'
|
types: [completed]
|
||||||
release:
|
branches: [master]
|
||||||
types: [published]
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
@@ -16,7 +15,8 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-and-upload:
|
build-and-upload:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -27,20 +27,14 @@ jobs:
|
|||||||
if [ -n "${{ github.event.inputs.version }}" ]; then
|
if [ -n "${{ github.event.inputs.version }}" ]; then
|
||||||
VERSION="${{ github.event.inputs.version }}"
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
echo "Using manual version: $VERSION"
|
echo "Using manual version: $VERSION"
|
||||||
elif [ "${{ github.event_name }}" = "release" ]; then
|
elif [ "${{ github.event_name }}" = "workflow_run" ]; then
|
||||||
VERSION="${{ github.event.release.tag_name }}"
|
VERSION=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name' | sed 's/^v//')
|
||||||
VERSION="${VERSION#v}"
|
echo "Using latest release version from workflow_run: $VERSION"
|
||||||
echo "Using release version: $VERSION"
|
|
||||||
elif [ "${{ github.event_name }}" = "push" ] && [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
|
||||||
VERSION="${{ github.ref_name }}"
|
|
||||||
VERSION="${VERSION#v}"
|
|
||||||
echo "Using tag version: $VERSION"
|
|
||||||
else
|
else
|
||||||
# Fallback to latest release
|
VERSION=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name' | sed 's/^v//')
|
||||||
VERSION=$(curl -s https://api.github.com/repos/AvengeMedia/DankMaterialShell/releases/latest | jq -r '.tag_name' | sed 's/^v//')
|
|
||||||
echo "Using latest release version: $VERSION"
|
echo "Using latest release version: $VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "✅ Building DMS stable version: $VERSION"
|
echo "✅ Building DMS stable version: $VERSION"
|
||||||
|
|
||||||
|
|||||||
22
.github/workflows/release.yml
vendored
22
.github/workflows/release.yml
vendored
@@ -219,25 +219,3 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Extract plain version
|
|
||||||
id: plain_version
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
if [[ "$TAG" == v* ]]; then
|
|
||||||
VERSION="${TAG#v}"
|
|
||||||
else
|
|
||||||
VERSION="$TAG"
|
|
||||||
fi
|
|
||||||
echo "plain=$VERSION" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Trigger Copr release workflow
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
VERSION="${{ steps.plain_version.outputs.plain }}"
|
|
||||||
JSON_PAYLOAD=$(jq -n --arg version "$VERSION" '{inputs:{version:$version}}')
|
|
||||||
curl -X POST \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
||||||
https://api.github.com/repos/${{ github.repository }}/actions/workflows/copr-release.yml/dispatches \
|
|
||||||
-d "$JSON_PAYLOAD"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user