|
| 1 | +--- |
| 2 | +##################### |
| 3 | +## Create releases ## |
| 4 | +##################### |
| 5 | + |
| 6 | +# |
| 7 | +# Documentation: |
| 8 | +# https://help.github.com/en/articles/workflow-syntax-for-github-actions |
| 9 | +# |
| 10 | + |
| 11 | +name: Release |
| 12 | +on: |
| 13 | + push: |
| 14 | + branches: [ main ] |
| 15 | + tags: [ 'v*.*.*' ] |
| 16 | + pull_request: |
| 17 | + types: [ labeled ] |
| 18 | + |
| 19 | +################# |
| 20 | +# Start the job # |
| 21 | +################# |
| 22 | +jobs: |
| 23 | + ############### |
| 24 | + # Steps below # |
| 25 | + ############### |
| 26 | + create-release: |
| 27 | + name: Create Release |
| 28 | + if: github.event.action != 'labeled' |
| 29 | + runs-on: ubuntu-latest |
| 30 | + timeout-minutes: 10 |
| 31 | + steps: |
| 32 | + ############################ |
| 33 | + # Checkout the source code # |
| 34 | + ############################ |
| 35 | + - name: Checkout Code |
| 36 | + |
| 37 | + |
| 38 | + ################################### |
| 39 | + # Bump version depending on label # |
| 40 | + ################################### |
| 41 | + - name: Bump version |
| 42 | + if: "!startsWith(github.ref, 'refs/tags/')" |
| 43 | + id: bumpr |
| 44 | + uses: haya14busa/action-bumpr@v1 |
| 45 | + |
| 46 | + ################### |
| 47 | + # Update the tags # |
| 48 | + ################### |
| 49 | + - name: Update tag |
| 50 | + if: "!steps.bumpr.outputs.skip" |
| 51 | + uses: haya14busa/action-update-semver@v1 |
| 52 | + with: |
| 53 | + tag: ${{ steps.bumpr.outputs.next_version }} |
| 54 | + |
| 55 | + ################ |
| 56 | + # Get tag name # |
| 57 | + ################ |
| 58 | + - name: Get tag name |
| 59 | + id: tag |
| 60 | + uses: haya14busa/action-cond@v1 |
| 61 | + with: |
| 62 | + cond: "${{ startsWith(github.ref, 'refs/tags/') }}" |
| 63 | + if_true: ${{ github.ref }} |
| 64 | + if_false: ${{ steps.bumpr.outputs.next_version }} |
| 65 | + |
| 66 | + ################## |
| 67 | + # Create release # |
| 68 | + ################## |
| 69 | + - name: Create release |
| 70 | + uses: softprops/action-gh-release@v1 |
| 71 | + if: "steps.tag.outputs.value != ''" |
| 72 | + with: |
| 73 | + name: Release ${{ steps.tag.outputs.value }} |
| 74 | + body: ${{ steps.bumpr.outputs.message }} |
| 75 | + tag_name: ${{ steps.tag.outputs.value }} |
| 76 | + draft: false |
| 77 | + prerelease: false |
| 78 | + |
| 79 | + ########################### |
| 80 | + # Release preview comment # |
| 81 | + ########################### |
| 82 | + release-check: |
| 83 | + if: github.event.action == 'labeled' |
| 84 | + runs-on: ubuntu-latest |
| 85 | + steps: |
| 86 | + ############################ |
| 87 | + # Checkout the source code # |
| 88 | + ############################ |
| 89 | + - name: Checkout Code |
| 90 | + |
| 91 | + |
| 92 | + ####################### |
| 93 | + # Post status comment # |
| 94 | + ####################### |
| 95 | + - name: Post bumpr status comment |
| 96 | + uses: haya14busa/action-bumpr@v1 |
0 commit comments