|
1 | 1 | name: build for test/release |
2 | 2 |
|
3 | 3 | on: |
4 | | - create: |
5 | | - tags: |
6 | | - - '**' |
7 | | - pull_request: |
8 | | - branches: |
9 | | - - master |
10 | 4 | push: |
11 | | - branches: |
12 | | - - master |
13 | | - - test* |
| 5 | + branches: ['prep/**', 'release/**', 'test/**', master, main] |
| 6 | + tags: ['**'] |
14 | 7 | workflow_dispatch: |
15 | 8 | jobs: |
16 | 9 | build: |
|
36 | 29 | export job_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID |
37 | 30 | export oss_exists=0 |
38 | 31 | export ftp_exists=0 |
39 | | - export rx='^v([0-9]+\.){0,2}(\*|[0-9]+)(-rc[0-9]*){0,1}$' |
40 | | - if [[ "${{github.ref_type}}" == "tag" ]] && [[ "${{github.event_name}}" == "create" ]] && [[ "$github_tag" =~ $rx ]]; then |
41 | | - export pub_method=pushRelease |
| 32 | + export is_tag_create=false |
| 33 | +
|
| 34 | + export rx_tag='^refs\/tags\/.*' |
| 35 | + export rx_version_tag='^v([0-9]+\.){0,2}(\*|[0-9]+)(-rc[0-9]*){0,1}$' |
| 36 | + if [[ "${{github.ref}}" =~ $rx_tag ]]; then |
| 37 | + export is_tag_create=true |
| 38 | + if [[ "${{github.ref_name}}" =~ $rx_version_tag ]]; then |
| 39 | + export pub_method=pushRelease |
| 40 | + fi |
42 | 41 | fi |
43 | 42 |
|
44 | 43 | if [[ "${{secrets.OSS_KEY_ID}}" != "" && \ |
|
50 | 49 | if [[ "${{secrets.FTP_HOST}}" != "" ]]; then |
51 | 50 | export ftp_exists=1 |
52 | 51 | fi |
| 52 | +
|
53 | 53 | echo "::set-output name=commit::$commit" |
54 | 54 | echo "::set-output name=short::$short" |
55 | 55 | echo "::set-output name=github_tag::$github_tag" |
|
60 | 60 | echo "::set-output name=artifact_name::$artifact_name" |
61 | 61 | echo "::set-output name=job_url::$job_url" |
62 | 62 | echo "::set-output name=pub_method::$pub_method" |
| 63 | + echo "::set-output name=is_tag_create:$is_tag_create" |
63 | 64 | echo "::set-output name=oss_exists::$oss_exists" |
64 | 65 | echo "::set-output name=ftp_exists::$ftp_exists" |
65 | 66 |
|
|
79 | 80 | echo secrets.godeye_url = ${{ secrets.GODEYE_URL }} |
80 | 81 | echo vars.oss_exists = ${{steps.vars.outputs.oss_exists}} |
81 | 82 | echo vars.ftp_exists = ${{steps.vars.outputs.ftp_exists}} |
| 83 | + echo vars.is_tag_create = ${{steps.vars.outputs.is_tag_create}} |
82 | 84 | echo github.ref = ${{github.ref}} |
83 | 85 | echo github.ref_name = ${{github.ref_name}} |
84 | 86 | echo vars.job_url = ${{steps.vars.outputs.job_url}} |
@@ -174,7 +176,7 @@ jobs: |
174 | 176 | set -e |
175 | 177 |
|
176 | 178 | - name: Publish the Docker image |
177 | | - if: ${{ github.ref_type == 'tag' && github.event_name == 'create' }} |
| 179 | + if: ${{ steps.vars.outputs.is_tag_create == 'true' }} |
178 | 180 | run: | |
179 | 181 | make docker-buildenv |
180 | 182 | make docker-runtime |
|
0 commit comments