batch-example/.gitea/workflows/pr-closed.yml

60 lines
2.1 KiB
YAML

name: build-develop-branch
run-name: ${{ github.actor }} is learning GitHub Actions
on:
pull_request:
types:
- closed
- deleted
branches:
- 'master'
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: get tea
run: |
curl https://dl.gitea.com/tea/0.9.2/tea-0.9.2-linux-386 --output ../tea
chmod +x ../tea
../tea login add -n=this --url=${{ github.server_url}} -t=${{ secrets.BOT_TOKEN }}
- uses: http://sigyl.com:3000/actions/checkout@v3.5.4
with:
token: ${{ secrets.BOT_TOKEN }}
- name: get tag
run: |
../tea r ls -o=simple
version="$(../tea r ls -o=simple | head -n 1 | tr " " "\n" | head -n 1)"
newversion=$version | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
echo $newversion
../tea r c --note="this isrelease ${newversion}" --tag=${newversion} --title=${newversion} --target=${{ github.sha }}
- name: delete develop branch
id: delete_develop_branch
run: git push origin --delete ${{ github.head_ref }}
continue-on-error: true
- uses: mainmatter/continue-on-error-comment@v1
with:
repo-token: ${{ secrets.BOT_TOKEN }}
outcome: ${{ steps.delete_develop_branch.outcome }}
test-id: Error code ${{ matrix.code }}
delete-develop:
runs-on: ubuntu-latest
steps:
- uses: http://sigyl.com:3000/actions/checkout@v3.5.4
with:
token: ${{ secrets.BOT_TOKEN }}
- name: delete develop branch
id: delete_develop_branch
run: git push origin --delete ${{ github.head_ref }}
continue-on-error: true
- uses: mainmatter/continue-on-error-comment@v1
with:
repo-token: ${{ secrets.BOT_TOKEN }}
outcome: ${{ steps.delete_develop_branch.outcome }}
test-id: Error code ${{ matrix.code }}
- name: get build branch name
run: |
firstString=${{ github.head_ref }}
secondString="build"
echo ::set-env name=BUILD_BRANCH::${firstString/develop\//"$secondString"\/}s