-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (74 loc) · 1.98 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Release
"on":
push:
branchs-ignore:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
get-changes:
runs-on: ubuntu-22.04
outputs:
updCont: ${{ steps.updCont.outputs.any_changed }}
dev: ${{ steps.dev.outputs.any_changed }}
existPR: ${{ steps.existPR.outputs.cnt }}
steps:
- uses: actions/checkout@v4
- name: Check updCont
uses: tj-actions/changed-files@v45
id: updCont
with:
base_sha: 'main'
files: |
content/**
data/**
- name: Check dev
uses: tj-actions/changed-files@v45
id: dev
with:
base_sha: 'main'
files: |
!content/**
!data/**
- name: Check exist PR
id: existPR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "cnt=$(gh pr list -B main -H ${{ github.ref_name }} | wc -l)" \
>> $GITHUB_OUTPUT
createPR:
runs-on: ubuntu-22.04
needs:
- get-changes
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Create PR
if: needs.get-changes.outputs.existPR == 0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--base "main" \
--head "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--body "" \
--draft
- name: Mark as post
if: needs.get-changes.outputs.updCont == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit "${{ github.ref_name }}" \
--add-label "create post"
- name: Mark as dev
if: needs.get-changes.outputs.dev == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit "${{ github.ref_name }}" \
--add-label "development"