|
| 1 | +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 2 | + |
| 3 | +name: "Create tag" |
| 4 | + |
| 5 | +on: |
| 6 | + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Next version' |
| 11 | + required: true |
| 12 | + default: 'patch' |
| 13 | + type: choice |
| 14 | + options: |
| 15 | + - patch |
| 16 | + - minor |
| 17 | + |
| 18 | +jobs: |
| 19 | + create-tag: |
| 20 | + name: "Create tag" |
| 21 | + runs-on: "ubuntu-latest" |
| 22 | + steps: |
| 23 | + - name: "Checkout" |
| 24 | + uses: actions/checkout@v3 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + token: ${{ secrets.PHPSTAN_BOT_TOKEN }} |
| 28 | + |
| 29 | + - name: 'Get Previous tag' |
| 30 | + id: previoustag |
| 31 | + uses: "WyriHaximus/github-action-get-previous-tag@v1" |
| 32 | + env: |
| 33 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 34 | + |
| 35 | + - name: 'Get next versions' |
| 36 | + id: semvers |
| 37 | + uses: "WyriHaximus/github-action-next-semvers@v1" |
| 38 | + with: |
| 39 | + version: ${{ steps.previoustag.outputs.tag }} |
| 40 | + |
| 41 | + - name: "Create new minor tag" |
| 42 | + uses: rickstaa/action-create-tag@v1 |
| 43 | + if: inputs.version == 'minor' |
| 44 | + with: |
| 45 | + tag: ${{ steps.semvers.outputs.minor }} |
| 46 | + message: ${{ steps.semvers.outputs.minor }} |
| 47 | + |
| 48 | + - name: "Create new patch tag" |
| 49 | + uses: rickstaa/action-create-tag@v1 |
| 50 | + if: inputs.version == 'patch' |
| 51 | + with: |
| 52 | + tag: ${{ steps.semvers.outputs.patch }} |
| 53 | + message: ${{ steps.semvers.outputs.patch }} |
0 commit comments