|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + new_version: |
| 7 | + description: 'New version' |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + release: |
| 12 | + name: Release |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout master |
| 16 | + uses: actions/checkout@v1 |
| 17 | + with: |
| 18 | + ref: 'master' |
| 19 | + - name: Checkout develop |
| 20 | + uses: actions/checkout@v1 |
| 21 | + with: |
| 22 | + ref: 'develop' |
| 23 | + clean: false |
| 24 | + - name: Install git-flow |
| 25 | + run: sudo apt-get install git-flow -y |
| 26 | + - name: Configure commiter |
| 27 | + run: | |
| 28 | + git config --local user.email "${{ secrets.WORKER_EMAIL }}" |
| 29 | + git config --local user.name "${{ secrets.WORKER_NAME }}" |
| 30 | + - name: Init git-flow |
| 31 | + run: git flow init -d |
| 32 | + - name: Start release |
| 33 | + run: git flow release start ${{ github.event.inputs.new_version }} |
| 34 | + - name: Replace Next tags with new version number |
| 35 | + uses: jacobtomlinson/gha-find-replace@master |
| 36 | + with: |
| 37 | + find: "(?i)\\[Next\\]" |
| 38 | + replace: "${{ github.event.inputs.new_version }}" |
| 39 | + - name: Replace stable tag in readme |
| 40 | + uses: jacobtomlinson/gha-find-replace@master |
| 41 | + with: |
| 42 | + find: "Stable tag: [0-9]+.[0-9]+.[0-9]+" |
| 43 | + replace: "Stable tag: ${{ github.event.inputs.new_version }}" |
| 44 | + include: "readme.txt" |
| 45 | + - name: Replace version tag in main file |
| 46 | + uses: jacobtomlinson/gha-find-replace@master |
| 47 | + with: |
| 48 | + find: "Version: [0-9]+.[0-9]+.[0-9]+" |
| 49 | + replace: "Version: ${{ github.event.inputs.new_version }}" |
| 50 | + include: "${{ secrets.SLUG }}.php" |
| 51 | + - name: Commit version bump |
| 52 | + run: git commit -am "Version bump" |
| 53 | + - name: Finish release |
| 54 | + run: git flow release finish ${{ github.event.inputs.new_version }} -m "v${{ github.event.inputs.new_version }}" |
| 55 | + - name: Push develop and tags |
| 56 | + uses: ad-m/github-push-action@master |
| 57 | + with: |
| 58 | + github_token: ${{ secrets.WORKER_TOKEN }} |
| 59 | + branch: 'develop' |
| 60 | + - name: Push master |
| 61 | + uses: ad-m/github-push-action@master |
| 62 | + with: |
| 63 | + github_token: ${{ secrets.WORKER_TOKEN }} |
| 64 | + branch: 'master' |
0 commit comments