Skip to content

Commit

Permalink
ci: better version output
Browse files Browse the repository at this point in the history
  • Loading branch information
xMikux committed Sep 23, 2024
1 parent 8325c8e commit d0f80e2
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ jobs:
needs: [ version-gen, config-upload, res-packer ]
uses: ./.github/workflows/resuable_release_modrinth.yml
with:
version: ${{ needs.version-gen.outputs.version_name }}
version: ${{ needs.version-gen.outputs.version_sha_name }}
secrets:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/release_versionts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release | Version Test

on:
workflow_dispatch: {}
push:

jobs:
version-gen-beta:
name: Version Generator
uses: ./.github/workflows/resuable_version.yml
if: |
github.repository == 'xMikux/Slimefun-Resourcepack'
with:
release_type: "beta"
version-gen-release:
name: Version Generator
uses: ./.github/workflows/resuable_version.yml
if: |
github.repository == 'xMikux/Slimefun-Resourcepack'
with:
release_type: "release"
generate-version-summary:
name: Generate Version Summary
runs-on: ubuntu-latest
needs: [ version-gen-beta, version-gen-release ]
steps:
- name: Act - Summary
run: |
echo "# Version Summary" >> $GITHUB_STEP_SUMMARY
echo "- Current Version: ${{ needs.version-gen-release.outputs.version_semver_current_name }}" >> $GITHUB_STEP_SUMMARY
echo "- Next Version: ${{ needs.version-gen-release.outputs.version_semver_next_name }}" >> $GITHUB_STEP_SUMMARY
echo "- SHA Version: ${{ needs.version-gen-release.outputs.version_sha_name }}" >> $GITHUB_STEP_SUMMARY
echo "- PackFormat - Beta: ${{ needs.version-gen-beta.outputs.pack_version_name }}" >> $GITHUB_STEP_SUMMARY
echo "- PackFormat - Release: ${{ needs.version-gen-release.outputs.pack_version_name }}" >> $GITHUB_STEP_SUMMARY
35 changes: 26 additions & 9 deletions .github/workflows/resuable_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ on:
required: false
default: "beta"
outputs:
version_name:
description: "The version name (ex: git-abcdef or v1.0.0 )"
value: ${{ jobs.version_maker.outputs.version_name }}
version_sha_name:
description: "The sha version name (ex: git-abcdef or v1.0.0 )"
value: ${{ jobs.version_maker.outputs.version_sha_name }}
version_semver_current_name:
description: "The semver current version name"
value: ${{ jobs.version_maker.outputs.version_semver_current_name }}
version_semver_next_name:
description: "The semver next version name"
value: ${{ jobs.version_maker.outputs.version_semver_next_name }}
pack_version_name:
description: "The pack format will use name (ex: Beta git-abcdef or Release v1.0.0)"
value: ${{ jobs.version_maker.outputs.pack_version_name }}
Expand All @@ -20,23 +26,34 @@ jobs:
name: Make Version
runs-on: ubuntu-latest
outputs:
version_name: ${{ steps.git_version.outputs.short_sha }}
version_sha_name: ${{ steps.version_list.outputs.sha_name }}
version_semver_current_name: ${{ steps.version_list.outputs.semver_current_name }}
version_semver_next_name: ${{ steps.version_list.outputs.semver_next_name }}
pack_version_name: ${{ steps.pack_version_name.outputs.version_name }}
steps:
-
name: Setup - Checkout Repository
uses: actions/checkout@v4
-
name: Version - Get Current Version
id: git_version
name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: main
-
name: Version - Get Versions
id: version_list
run: |
echo "short_sha=git-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
echo "sha_name=git-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
echo "semver_current_name=${{ steps.semver.outputs.current }}" >> "$GITHUB_OUTPUT"
echo "semver_next_name=${{ steps.semver.outputs.next }}" >> "$GITHUB_OUTPUT"
-
name: Pack Format - Version Name
id: pack_version_name
run: |
if [ "${{ inputs.release_type }}" == "beta" ]; then
echo "version_name=§dBeta §f${{ steps.git_version.outputs.short_sha }}" >> "$GITHUB_OUTPUT"
echo "version_name=§dBeta §f${{ steps.version_list.outputs.sha_name }}" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.release_type }}" == "release" ]; then
echo "version_name=§bRelease §fvABC?" >> "$GITHUB_OUTPUT"
echo "version_name=§bRelease §f${{ steps.version_list.outputs.semver_next_name }}" >> "$GITHUB_OUTPUT"
fi

0 comments on commit d0f80e2

Please sign in to comment.