Create Version Tag #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Version Tag | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version number (e.g., 1.2.3 without v prefix)' | |
| required: true | |
| type: string | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: main | |
| - name: Generate Version.php | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| RELEASE_DATE=$(date +%Y-%m-%d) | |
| cat > src/Version.php << EOF | |
| <?php | |
| namespace Feolius\Hell2Shape; | |
| /** | |
| * Version information for hell2shape. | |
| * This file is automatically generated during release. | |
| * Do not edit manually. | |
| */ | |
| final class Version | |
| { | |
| public const VERSION = '$VERSION'; | |
| public const RELEASE_DATE = '$RELEASE_DATE'; | |
| } | |
| EOF | |
| echo "Generated Version.php:" | |
| cat src/Version.php | |
| - name: Commit Version.php | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: Release ${{ github.event.inputs.version }} | |
| tag_name: ${{ github.event.inputs.version }} |