ability to generate releases by manually running workflows

This commit is contained in:
2026-05-26 18:46:52 +03:00
parent 7abb846a81
commit d8bc65e0d6
+18 -4
View File
@@ -10,6 +10,11 @@ on:
branches: branches:
- main - main
workflow_dispatch: workflow_dispatch:
inputs:
release_tag:
description: "Optional tag to release (e.g. v1.1)"
required: false
type: string
jobs: jobs:
build: build:
@@ -28,30 +33,39 @@ jobs:
run: make clean build run: make clean build
release: release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || (github.event_name == 'workflow_dispatch' && inputs.release_tag != '')
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: debian:11 container: debian:11
permissions: permissions:
contents: write contents: write
steps: steps:
- name: Checkout - name: Checkout (tag push)
uses: actions/checkout@v4 uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Checkout (manual tag)
uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
ref: ${{ inputs.release_tag }}
- name: Install build dependencies - name: Install build dependencies
run: apt-get update && apt-get install -y --no-install-recommends make g++ git tar ca-certificates run: apt-get update && apt-get install -y --no-install-recommends make g++ git tar ca-certificates
- name: Build release tarball - name: Build release tarball
run: make release VERSION=${{ github.ref_name }} run: make release VERSION=${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.ref_name }}
- name: Upload workflow artifact - name: Upload workflow artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: fetchit-${{ github.ref_name }}-linux-x86_64-gnu name: fetchit-${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.ref_name }}-linux-x86_64-gnu
path: dist/*.tar.gz path: dist/*.tar.gz
- name: Publish GitHub release - name: Publish GitHub release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.ref_name }}
files: dist/*.tar.gz files: dist/*.tar.gz
overwrite_files: true
generate_release_notes: true generate_release_notes: true