name: CI
on:
  pull_request:
    types: [opened, synchronize]
jobs:
  build:
    name: 1. BUILD
    runs-on: ubuntu
    env:
      VERSION: "0.0.0-beta.${{ gitea.run_number }}"
    steps:
    - name: Publishing Release
      uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }}
      with:
        name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}"
        tag_name: "v${{ env.VERSION }}"
        target_commitish: ${{ gitea.sha }}
        prerelease: ${{ gitea.base_ref == 'develop' }}
  test:
    name: 2. TEST
    runs-on: ubuntu
    needs: [build]
    outputs:
      message: ${{ steps.composite-template.outputs.message }}
    steps:
    - name: Source Code Checkout
      uses: actions/checkout@${{ vars.ACTION_CHECKOUT_VERSION }}
    - name: Run Composite Template
      id: composite-template
      uses: ./
  result:
    name: 3. RESULT
    runs-on: ubuntu
    needs: [build,test]
    env:
      MESSAGE: ${{ needs.test.outputs.message }}
    steps:
    - name: Show Message
      run: echo "$MESSAGE"
