mirror of
https://github.com/mon/ifs_layeredfs.git
synced 2026-05-21 02:42:30 -05:00
48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: Tag to release
|
|
required: true
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Wait for build to finish
|
|
id: find-run
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
# Find the most recent build run for this tag
|
|
run_id=$(gh run list -R "$GITHUB_REPOSITORY" -w Build --branch "${{ inputs.tag }}" --limit 1 --json databaseId -q '.[0].databaseId')
|
|
if [ -z "$run_id" ]; then
|
|
echo "No build found for tag ${{ inputs.tag }}"
|
|
exit 1
|
|
fi
|
|
echo "Waiting for build run $run_id to complete..."
|
|
gh run watch "$run_id" -R "$GITHUB_REPOSITORY" --exit-status
|
|
echo "run_id=$run_id" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
github-token: ${{ github.token }}
|
|
run-id: ${{ steps.find-run.outputs.run_id }}
|
|
|
|
- name: Create or update release
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
zip=$(ls dist/*.zip)
|
|
if gh release view "${{ inputs.tag }}" -R "$GITHUB_REPOSITORY" &>/dev/null; then
|
|
gh release upload "${{ inputs.tag }}" "$zip" --clobber -R "$GITHUB_REPOSITORY"
|
|
else
|
|
gh release create "${{ inputs.tag }}" "$zip" --prerelease --title "${{ inputs.tag }}" --notes "" -R "$GITHUB_REPOSITORY"
|
|
fi
|