Merge pull request #4 from Moderlab-Production/develop

Split pull request config to be more modulable
This commit is contained in:
Aurelien Vaillant
2022-02-01 15:24:50 +01:00
committed by GitHub
3 changed files with 61 additions and 25 deletions
+23
View File
@@ -0,0 +1,23 @@
name: Create base release
on:
workflow_call:
inputs:
bump_version:
description: 'The bump release'
type: string
required: true
default: 'false'
jobs:
init-release-data:
name: Generate data about the release
runs-on: ubuntu-latest
steps:
- name: Setup a new Semantic Version
id: new_semantic_setup
uses: zwaldowski/semver-release-action@v2
with:
bump: ${{ inputs.bump_version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
@@ -6,6 +6,10 @@ on:
jobs: jobs:
init-release-data: init-release-data:
# Generate some output :
# - Tag number
# - Release draft type
name: Initialize all data about the package name: Initialize all data about the package
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
@@ -24,31 +28,7 @@ jobs:
else else
echo "::set-output name=type::patch" echo "::set-output name=type::patch"
fi fi
echo "debug event : ${{ github.event.pull_request.opened == true }}"
echo "debug event : ${{ github.event.pull_request.opened == 'true' }}"
echo "debug event : ${{ github.event.pull_request.opened }}"
echo "debug event : ${{ github.event.action == 'opened' }}"
- name: Setup a new Semantic Version
id: new_semantic_setup
if: ${{ github.event.action == 'opened' }}
uses: zwaldowski/semver-release-action@v2
with:
bump: ${{ steps.bump_setup.outputs.type }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
- name: Prepare the release
uses: ncipollo/release-action@v1.8.10
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
tag: 'v${{ steps.new_semantic_setup.outputs.version }}'
# Config the release number
# - get tag with sync PR
# - publish the release if the PR is closed
- name: Get the Semantic tag Version - name: Get the Semantic tag Version
id: get_semantic_setup id: get_semantic_setup
uses: oprypin/find-latest-tag@v1.1.0 uses: oprypin/find-latest-tag@v1.1.0
@@ -58,6 +38,15 @@ jobs:
prefix: 'v' prefix: 'v'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Increment if a new release are needed to generated
if: ${{ github.event.action == 'opened' }}
id: new_semantic_setup
uses: zwaldowski/semver-release-action@v2
with:
bump: ${{ inputs.num_version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
- name: From all use case, get the Tag version - name: From all use case, get the Tag version
id: semantic_setup id: semantic_setup
run: | run: |
@@ -65,7 +54,21 @@ jobs:
if [ "${{ github.event.action }}" == "closed" ]; then if [ "${{ github.event.action }}" == "closed" ]; then
echo "::set-output name=version::${tag:1}" echo "::set-output name=version::${tag:1}"
echo "::set-output name=draft::false" echo "::set-output name=draft::false"
elif [ "${{ github.event.action }}" == "opened" ]; then
echo "::set-output name=version::${{ new_semantic_setup.outputs.version }}"
echo "::set-output name=draft::true"
else else
echo "::set-output name=version::${tag:1}" echo "::set-output name=version::${tag:1}"
echo "::set-output name=draft::true" echo "::set-output name=draft::true"
fi fi
- name: Debug all Data
run: |
echo "Show version Type"
echo ${{ outputs.version_type }}
echo "Show version number"
echo ${{ outputs.version_number }}
echo "Show version draft"
echo ${{ outputs.version_draft }}
echo "Show version name"
echo ${{ outputs.version_name }}
+11 -1
View File
@@ -12,12 +12,22 @@ on:
jobs: jobs:
init-release-data: init-release-data:
name: Initialize all data about the package name: Initialize all data about the package
uses: Moderlab-Production/BlenderTemplate/.github/workflows/init_release.yml@main uses: Moderlab-Production/BlenderTemplate/.github/workflows/initialyse_data.yml@main
prepare-first-release:
name: Make the pre-release
needs:
- init-release-data
if: ${{ github.event.action == 'opened' }}
uses: Moderlab-Production/BlenderTemplate/.github/workflows/generate_release.yml@main
with:
bump_version: ${{ needs.init-release-data.outputs.version_type }}
unit-test: unit-test:
uses: Moderlab-Production/BlenderTemplate/.github/workflows/unit_test.yml@main uses: Moderlab-Production/BlenderTemplate/.github/workflows/unit_test.yml@main
release-package: release-package:
name: Generate archive package
needs: needs:
- init-release-data - init-release-data
uses: Moderlab-Production/BlenderTemplate/.github/workflows/package.yml@main uses: Moderlab-Production/BlenderTemplate/.github/workflows/package.yml@main