7
7
- main
8
8
- latest
9
9
- ' pre/*'
10
+ - ' v*'
10
11
workflow_dispatch :
11
12
inputs :
12
13
env :
35
36
steps :
36
37
- id : setenv
37
38
run : |
38
- if test -n "${{ github.event.inputs.env }}"
39
+ if [[ "${{ needs.extract_branch.outputs.branch }}" =~ ^v.*$ ]]
40
+ then
41
+ echo "::set-output name=env::version"
42
+ echo "ENV=version" >> $GITHUB_ENV
43
+ elif test -n "${{ github.event.inputs.env }}"
39
44
then
40
45
echo "::set-output name=env::${{ github.event.inputs.env }}"
41
46
echo "ENV=${{ github.event.inputs.env }}" >> $GITHUB_ENV
@@ -55,23 +60,35 @@ jobs:
55
60
run : |
56
61
echo "The destination branch is ${{ needs.extract_branch.outputs.branch }}"
57
62
case ${{ env.ENV }} in
63
+ version)
64
+ new_branch_name="${{ needs.extract_branch.outputs.branch }}"
65
+ echo "::set-output name=branch::${new_branch_name}"
66
+ ;;
58
67
dev)
59
- echo "::set-output name=branch::${{ needs.extract_branch.outputs.branch }}"
60
- ;;
68
+ echo "::set-output name=branch::${{ needs.extract_branch.outputs.branch }}"
69
+ ;;
61
70
prod)
62
- echo "::set-output name=branch::main"
63
- ;;
71
+ echo "::set-output name=branch::main"
72
+ ;;
64
73
esac
65
74
build-and-deploy :
66
75
needs : set_env
67
76
runs-on : ubuntu-latest
68
77
steps :
69
78
- name : Checkout
70
79
uses : actions/checkout@v3
80
+ - name : Create new branch if version pattern
81
+ uses :
GuillaumeFalourd/[email protected]
82
+ with :
83
+ repository_owner : flexcompute-readthedocs
84
+ repository_name : tidy3d-docs
85
+ new_branch_name : ${{ needs.set_env.outputs.dest-branch }}
86
+ access_token : ${{ secrets.GH_PAT }}
87
+ ignore_branch_exists : true
71
88
- uses : JamesIves/github-pages-deploy-action@v4
72
89
with :
73
90
folder : .
74
91
token : ${{ secrets.GH_PAT }}
75
92
repository-name : flexcompute-readthedocs/tidy3d-docs
76
93
target-folder : .
77
- branch : ${{ needs.set_env.outputs.dest-branch }}
94
+ branch : ${{ needs.set_env.outputs.dest-branch }}
0 commit comments