1111 description : ' Create Production Release'
1212 required : true
1313 type : boolean
14+ skiptests :
15+ description : ' Skip Tests'
16+ required : true
17+ type : boolean
1418
1519jobs :
20+ # -----------------------------------------------------------------
21+ # PREPARE
22+ # -----------------------------------------------------------------
23+ prepare :
24+ name : Prepare Release
25+ outputs :
26+ should_deploy : ${{ steps.buildvars.outputs.should_deploy }}
27+ pkg_version : ${{ steps.buildvars.outputs.pkg_version }}
28+ pkg_version_strict : ${{ steps.buildvars.outputs.pkg_version_strict }}
29+
30+ steps :
31+ - uses : actions/checkout@v2
32+ with :
33+ fetch-depth : 0
34+
35+ - name : Get Next Version
36+ if : ${{ github.event.inputs.publish == 'true' }}
37+ id : semver
38+ uses : ietf-tools/semver-action@v1
39+ with :
40+ token : ${{ github.token }}
41+ branch : main
42+
43+ - name : Set Next Version Env Var
44+ if : ${{ github.event.inputs.publish == 'true' }}
45+ env :
46+ NEXT_VERSION : ${{ steps.semver.outputs.next }}
47+ run : |
48+ echo "NEXT_VERSION=$next" >> $GITHUB_ENV
49+
50+ - name : Create Draft Release
51+ uses : ncipollo/release-action@v1
52+ if : ${{ github.event.inputs.publish == 'true' }}
53+ with :
54+ prerelease : true
55+ draft : false
56+ commit : ${{ github.sha }}
57+ tag : ${{ env.NEXT_VERSION }}
58+ name : ${{ env.NEXT_VERSION }}
59+ body : ' *pending*'
60+ token : ${{ secrets.GITHUB_TOKEN }}
61+
62+ - name : Set Build Variables
63+ id : buildvars
64+ run : |
65+ if [[ $NEXT_VERSION ]]; then
66+ echo "Using AUTO SEMVER mode: $NEXT_VERSION"
67+ echo "::set-output name=should_deploy::true"
68+ echo "::set-output name=pkg_version::$NEXT_VERSION"
69+ echo "::set-output name=pkg_version_strict::${NEXT_VERSION#?}"
70+ echo "::notice::Release created using branch $GITHUB_REF_NAME"
71+ elif [[ "$GITHUB_REF" =~ ^refs/tags/v* ]]; then
72+ echo "Using TAG mode: $GITHUB_REF_NAME"
73+ echo "::set-output name=should_deploy::true"
74+ echo "::set-output name=pkg_version::$GITHUB_REF_NAME"
75+ echo "::set-output name=pkg_version_strict::${GITHUB_REF_NAME#?}"
76+ echo "::notice::Release created using tag $GITHUB_REF_NAME"
77+ else
78+ echo "Using TEST mode: v7.0.0-dev.$GITHUB_RUN_NUMBER"
79+ echo "::set-output name=should_deploy::false"
80+ echo "::set-output name=pkg_version::v3.0.0-dev.$GITHUB_RUN_NUMBER"
81+ echo "::set-output name=pkg_version_strict::3.0.0-dev.$GITHUB_RUN_NUMBER"
82+ echo "::notice::Non-production build created using branch $GITHUB_REF_NAME"
83+ fi
84+
85+ # -----------------------------------------------------------------
86+ # TESTS
87+ # -----------------------------------------------------------------
1688 tests :
1789 name : Run Tests
90+ if : ${{ github.event.inputs.skiptests == 'false' }}
91+ needs : [prepare]
1892 runs-on : ubuntu-latest
1993 container : ghcr.io/ietf-tools/datatracker-test-base:latest
2094
@@ -33,20 +107,7 @@ jobs:
33107 - uses : actions/checkout@v3
34108
35109 - name : Prepare for tests
36- run : |
37- echo "Running containers:"
38- docker ps -a
39- echo "Fixing permissions..."
40- chmod -R 777 ./
41- echo "Copying config files..."
42- cp ./docker/configs/settings_local.py ./ietf/settings_local.py
43- echo "Installing NPM packages..."
44- npm install --prefer-offline --no-audit
45- echo "Building static assets..."
46- npx parcel build
47- echo "Creating data directories..."
48- chmod +x ./docker/scripts/app-create-dirs.sh
49- ./docker/scripts/app-create-dirs.sh
110+ run : ./dev/tests/prepare.sh
50111
51112 - name : Ensure DB is ready
52113 run : |
@@ -66,65 +127,24 @@ jobs:
66127 name : coverage
67128 path : coverage.json
68129
69- publish :
70- needs :
71- - tests
130+ # -----------------------------------------------------------------
131+ # RELEASE
132+ # -----------------------------------------------------------------
133+ release :
134+ name : Make Release
135+ if : ${{ always() }}
136+ needs : [tests, prepare]
72137 runs-on : ubuntu-latest
138+ env :
139+ SHOULD_DEPLOY : ${{needs.prepare.outputs.should_deploy}}
140+ PKG_VERSION : ${{needs.prepare.outputs.pkg_version}}
141+ PKG_VERSION_STRICT : ${{needs.prepare.outputs.pkg_version_strict}}
73142
74143 steps :
75144 - uses : actions/checkout@v2
76145 with :
77146 fetch-depth : 0
78147
79- - name : Get Next Version
80- if : ${{ github.event.inputs.publish == 'true' }}
81- id : semver
82- uses : ietf-tools/semver-action@v1
83- with :
84- token : ${{ github.token }}
85- branch : main
86-
87- - name : Set Next Version Env Var
88- if : ${{ github.event.inputs.publish == 'true' }}
89- env :
90- NEXT_VERSION : ${{ steps.semver.outputs.next }}
91- run : |
92- echo "NEXT_VERSION=$next" >> $GITHUB_ENV
93-
94- - name : Create Draft Release
95- uses : ncipollo/release-action@v1
96- if : ${{ github.event.inputs.publish == 'true' }}
97- with :
98- prerelease : true
99- draft : false
100- commit : ${{ github.sha }}
101- tag : ${{ env.NEXT_VERSION }}
102- name : ${{ env.NEXT_VERSION }}
103- body : ' *pending*'
104- token : ${{ secrets.GITHUB_TOKEN }}
105-
106- - name : Set Build Variables
107- run : |
108- if [[ $NEXT_VERSION ]]; then
109- echo "Using AUTO SEMVER mode: $NEXT_VERSION"
110- echo "SHOULD_DEPLOY=true" >> $GITHUB_ENV
111- echo "PKG_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
112- echo "PKG_VERSION_STRICT=${NEXT_VERSION#?}" >> $GITHUB_ENV
113- echo "::notice::Release created using branch $GITHUB_REF_NAME"
114- elif [[ "$GITHUB_REF" =~ ^refs/tags/v* ]]; then
115- echo "Using TAG mode: $GITHUB_REF_NAME"
116- echo "SHOULD_DEPLOY=true" >> $GITHUB_ENV
117- echo "PKG_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
118- echo "PKG_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
119- echo "::notice::Release created using tag $GITHUB_REF_NAME"
120- else
121- echo "Using TEST mode: v7.0.0-dev.$GITHUB_RUN_NUMBER"
122- echo "SHOULD_DEPLOY=false" >> $GITHUB_ENV
123- echo "PKG_VERSION=v3.0.0-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
124- echo "PKG_VERSION_STRICT=3.0.0-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
125- echo "::notice::Non-production build created using branch $GITHUB_REF_NAME"
126- fi
127-
128148 - name : Setup Node.js
129149 uses : actions/setup-node@v3.0.0
130150 with :
0 commit comments