72 lines
2.5 KiB
YAML
72 lines
2.5 KiB
YAML
name: Create base release
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
|
|
jobs:
|
|
init-release-data:
|
|
name: Initialize all data about the package
|
|
runs-on: ubuntu-latest
|
|
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
|
|
|
|
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
|
|
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
|