Test to split the PR request ci with 2 files (more readable)

This commit is contained in:
Aurelien Vaillant
2022-01-31 18:19:16 +01:00
parent 6e2d7cd396
commit 1889303203
2 changed files with 39 additions and 56 deletions
+37 -14
View File
@@ -1,19 +1,18 @@
name: Create base release name: Create base release
on: on:
pull_request: workflow_call:
branches:
[main]
types:
[opened]
jobs: jobs:
create-release: init-release-data:
name: Create a new release name: Initialize all data about the package
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
version_type: ${{ steps.bump_setup.outputs.type }} version_type: ${{ steps.bump_setup.outputs.type }}
version_number: ${{ steps.semantic_setup.outputs.version }}
version_draft: ${{ steps.semantic_setup.outputs.draft }}
version_name: v${{ steps.semantic_setup.outputs.version }}
steps: steps:
- name: Setup bump release - name: Setup bump release
id: bump_setup id: bump_setup
@@ -26,8 +25,14 @@ jobs:
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 - name: Setup a new Semantic Version
id: semantic_setup id: new_semantic_setup
if: ${{ github.event.action == 'opened' }}
uses: zwaldowski/semver-release-action@v2 uses: zwaldowski/semver-release-action@v2
with: with:
bump: ${{ steps.bump_setup.outputs.type }} bump: ${{ steps.bump_setup.outputs.type }}
@@ -39,10 +44,28 @@ jobs:
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true prerelease: true
tag: 'v${{ steps.semantic_setup.outputs.version }}' tag: 'v${{ steps.new_semantic_setup.outputs.version }}'
pull-request-ci: # Config the release number
name: Start all pull request CI jobs # - get tag with sync PR
needs: # - publish the release if the PR is closed
- create-release - name: Get the Semantic tag Version
uses: Moderlab-Production/BlenderTemplate/.github/workflows/pr_main.yml@main id: get_semantic_setup
uses: oprypin/find-latest-tag@v1.1.0
with:
repository: ${{ github.repository }}
releases-only: true
prefix: 'v'
token: ${{ secrets.GITHUB_TOKEN }}
- name: From all use case, get the Tag version
id: semantic_setup
run: |
tag=${{ steps.get_semantic_setup.outputs.tag }}
if [ "${{ github.event.action }}" == "closed" ]; then
echo "::set-output name=version::${tag:1}"
echo "::set-output name=draft::false"
else
echo "::set-output name=version::${tag:1}"
echo "::set-output name=draft::true"
fi
+2 -42
View File
@@ -6,53 +6,13 @@ on:
branches: branches:
[main] [main]
types: types:
[edited, synchronize, closed] [opened, edited, synchronize, closed]
jobs: jobs:
init-release-data: init-release-data:
name: Initialize all data about the package name: Initialize all data about the package
runs-on: ubuntu-latest uses: Moderlab-Production/BlenderTemplate/.github/workflows/init_release.yml@main
outputs:
version_type: ${{ steps.bump_setup.outputs.type }}
version_number: ${{ steps.semantic_setup.outputs.version }}
version_draft: ${{ steps.semantic_setup.outputs.draft }}
version_name: v${{ steps.semantic_setup.outputs.version }}
steps:
- name: Setup bump release
id: bump_setup
run: |
if [ ${{ contains(github.event.pull_request.labels.*.name, 'release:major') }} == true ]; then
echo "::set-output name=type::major"
elif [ ${{ contains(github.event.pull_request.labels.*.name, 'release:minor') }} == true ]; then
echo "::set-output name=type::minor"
else
echo "::set-output name=type::patch"
fi
# Config the release number
# - get tag with sync PR
# - publish the release if the PR is closed
- name: Get the Semantic tag Version
id: get_semantic_setup
uses: oprypin/find-latest-tag@v1.1.0
with:
repository: ${{ github.repository }}
releases-only: true
prefix: 'v'
token: ${{ secrets.GITHUB_TOKEN }}
- name: From all use case, get the Tag version
id: semantic_setup
run: |
tag=${{ steps.get_semantic_setup.outputs.tag }}
if [ "${{ github.event.action }}" == "closed" ]; then
echo "::set-output name=version::${tag:1}"
echo "::set-output name=draft::false"
else
echo "::set-output name=version::${tag:1}"
echo "::set-output name=draft::true"
fi
unit-test: unit-test:
uses: Moderlab-Production/BlenderTemplate/.github/workflows/unit_test.yml@main uses: Moderlab-Production/BlenderTemplate/.github/workflows/unit_test.yml@main