Skip to content

Commit 835c123

Browse files
chore: sync workflows
1 parent efec67d commit 835c123

File tree

4 files changed

+76
-30
lines changed

4 files changed

+76
-30
lines changed

.github/workflows/add-version-tag.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ jobs:
1010
tag:
1111
name: Add version tag
1212
runs-on: ubuntu-latest
13-
if: github.event.pull_request.merged == true && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.event.pull_request.head.ref, 'release/')
13+
if: github.event.pull_request.merged == true && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/')
1414
steps:
1515
- name: Get version
1616
uses: technote-space/get-next-version-action@v1
1717
with:
1818
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
if: github.event.pull_request.head.ref == 'release/next'
19+
EXCLUDE_MESSAGES: |
20+
update package version
21+
update packages
22+
if: "! startsWith(github.head_ref, 'release/v')"
2023
- name: Get version
2124
run: echo "::set-env name=NEXT_VERSION::${HEAD_REF#release/}"
2225
env:
23-
HEAD_REF: ${{ github.event.pull_request.head.ref }}
24-
if: startsWith(github.event.pull_request.head.ref, 'release/v')
26+
HEAD_REF: ${{ github.head_ref }}
27+
if: startsWith(github.head_ref, 'release/v')
2528
- uses: actions/[email protected]
2629
with:
2730
github-token: ${{ secrets.ACCESS_TOKEN }}

.github/workflows/pr-opened.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,3 @@ jobs:
3434
uses: technote-space/pr-labeler-action@v3
3535
with:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
38-
checkVersion:
39-
name: Check package version
40-
runs-on: ubuntu-latest
41-
if: github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.event.pull_request.head.ref, 'release/v')
42-
steps:
43-
- name: Set running flag
44-
run: echo "::set-env name=RUNNING::1"
45-
- uses: actions/checkout@v2
46-
- name: Set running flag
47-
run: |
48-
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
49-
echo "::set-env name=RUNNING::"
50-
fi
51-
52-
- name: Check package version
53-
uses: technote-space/package-version-check-action@v1
54-
with:
55-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
56-
BRANCH_PREFIX: release/
57-
if: env.RUNNING

.github/workflows/pr-updated.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
triage:
99
name: Pull Request Labeler
1010
runs-on: ubuntu-latest
11-
if: "! startsWith(github.event.pull_request.head.ref, 'release/')"
11+
if: "! startsWith(github.head_ref, 'release/')"
1212
steps:
1313
- name: Pull Request Labeler
1414
uses: actions/labeler@v2
@@ -30,13 +30,13 @@ jobs:
3030
update package version
3131
update wp version
3232
TITLE: '## Changes'
33-
LINK_ISSUE_KEYWORD: ${{ (startsWith(github.event.pull_request.head.ref, 'release/') && 'closes') || '' }}
33+
LINK_ISSUE_KEYWORD: ${{ (startsWith(github.head_ref, 'release/') && 'closes') || '' }}
3434
FILTER_PR: true
3535

3636
manageRelease:
3737
name: Manage release
3838
runs-on: ubuntu-latest
39-
if: github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && github.event.pull_request.head.ref == 'release/next'
39+
if: "github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/') && ! startsWith(github.head_ref, 'release/v')"
4040
steps:
4141
- name: Manage release
4242
uses: technote-space/release-type-action@v1
@@ -45,3 +45,33 @@ jobs:
4545
EXCLUDE_MESSAGES: |
4646
update package version
4747
update packages
48+
49+
checkVersion:
50+
name: Check package version
51+
runs-on: ubuntu-latest
52+
if: "github.event.action == 'synchronize' && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/') && ! startsWith(github.head_ref, 'release/v')"
53+
steps:
54+
- name: Set running flag
55+
run: echo "::set-env name=RUNNING::1"
56+
- uses: actions/checkout@v2
57+
- name: Set running flag
58+
run: |
59+
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
60+
echo "::set-env name=RUNNING::"
61+
fi
62+
63+
- name: Get version
64+
uses: technote-space/get-next-version-action@v1
65+
with:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
EXCLUDE_MESSAGES: |
68+
update package version
69+
update packages
70+
if: env.RUNNING
71+
- name: Check package version
72+
uses: technote-space/package-version-check-action@v1
73+
with:
74+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
75+
BRANCH_PREFIX: release/
76+
NEXT_VERSION: ${{ env.NEXT_VERSION }}
77+
if: env.NEXT_VERSION

.github/workflows/update-dependencies.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Update dependencies
16+
id: update_deps
1617
uses: technote-space/create-pr-action@v1
1718
with:
1819
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
@@ -25,7 +26,40 @@ jobs:
2526
PR_BRANCH_NAME: 'chore-npm-update-${PR_ID}'
2627
PR_TITLE: 'chore: update npm dependencies (${PR_MERGE_REF})'
2728
PR_DEFAULT_BRANCH_PREFIX: release/
28-
PR_DEFAULT_BRANCH_NAME: next
29-
PR_DEFAULT_BRANCH_TITLE: 'feat: release ${PATCH_VERSION}'
29+
PR_DEFAULT_BRANCH_NAME: next-${CURRENT_VERSION}
30+
PR_DEFAULT_BRANCH_TITLE: 'feat: release'
3031
TARGET_BRANCH_PREFIX: release/
3132
AUTO_MERGE_THRESHOLD_DAYS: 14
33+
34+
- name: Set running flag
35+
run: echo "::set-env name=RUNNING::"
36+
- name: Set running flag
37+
run: echo "::set-env name=RUNNING::1"
38+
if: steps.update_deps.outputs.result != 'succeeded' && github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/')
39+
- uses: actions/checkout@v2
40+
if: env.RUNNING
41+
- name: Set running flag
42+
run: |
43+
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
44+
echo "::set-env name=RUNNING::"
45+
fi
46+
- name: Get version
47+
uses: technote-space/get-next-version-action@v1
48+
with:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
EXCLUDE_MESSAGES: |
51+
update package version
52+
update packages
53+
if: "env.RUNNING && ! startsWith(github.head_ref, 'release/v')"
54+
- name: Get version
55+
run: echo "::set-env name=NEXT_VERSION::${HEAD_REF#release/}"
56+
env:
57+
HEAD_REF: ${{ github.head_ref }}
58+
if: env.RUNNING && startsWith(github.head_ref, 'release/v')
59+
- name: Check package version
60+
uses: technote-space/package-version-check-action@v1
61+
with:
62+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
63+
BRANCH_PREFIX: release/
64+
NEXT_VERSION: ${{ env.NEXT_VERSION }}
65+
if: env.NEXT_VERSION

0 commit comments

Comments
 (0)