44 branches :
55 # Matches release branches
66 - " [0-9]+.[0-9]+"
7- - main
87
98concurrency : ${{ github.workflow }}-${{ github.ref }}
109
5352 checks : write
5453 outputs :
5554 MINOR_VERSION : ${{ env.MINOR_VERSION }}
56- CUSTOM_VERSION : ${{ env.CUSTOM_VERSION || env.BRANCH_NAME }}
57- BRANCH_NAME : ${{ env.BRANCH_NAME }}
55+ CUSTOM_VERSION : ${{ env.CUSTOM_VERSION || env.VERSION }}
5856 env :
5957 # # backward compatibility for older versions
6058 APPS_MARKETPLACE_API_URI : " https://apps.staging.saleor.io/api/v2/saleor-apps"
@@ -71,28 +69,35 @@ jobs:
7169 SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
7270 APPS_MARKETPLACE_API_URL : " https://apps.staging.saleor.io/api/v2/saleor-apps"
7371 EXTENSIONS_API_URL : " https://apps.staging.saleor.io/api/v1/extensions"
74- BRANCH_NAME : ${{ github.event.inputs.git_ref || github.ref_name }}
72+ VERSION : ${{ github.event.inputs.git_ref || github.ref_name }}
7573 IS_CLOUD_INSTANCE : true
7674 ENABLED_SERVICE_NAME_HEADER : true
7775 ONBOARDING_USER_JOINED_DATE_THRESHOLD : ${{ vars.STAGING_ONBOARDING_USER_JOINED_DATE_THRESHOLD }}
7876 steps :
7977 - uses : actions/checkout@v4
8078 with :
81- ref : ${{ env.BRANCH_NAME }}
79+ ref : ${{ env.VERSION }}
8280
83- - name : Set env variables
81+ - name : Set environment
82+ # Convert version into staging deployment name (e.g 3.3.0 -> saleor-staging-v33)
83+ run : |
84+ set -x
85+ environment=$(echo $VERSION | sed -n 's#\([0-9]\+\).\([0-9]\+\).*#saleor-staging-v\1\2#p')
86+ echo "ENVIRONMENT=${environment}" >> "$GITHUB_ENV"
87+
88+ - name : Set custom version
89+ env :
90+ VERSION : ${{ github.event.inputs.git_ref || github.ref_name }}
91+ # Add commit hash to basic version number
8492 run : |
8593 set -x
8694 HASH=$(git rev-parse --short HEAD)
8795 CURRENT_VERSION=$(jq -r .version package.json)
8896 RELEASE="${CURRENT_VERSION}-${HASH}"
89- MINOR_VERSION=$(echo "${RELEASE}" | sed -E 's/^([0-9]+\.[0-9]+)\..*/\1/')
90- ENVIRONMENT=$(echo "saleor-staging-v${MINOR_VERSION//./}")
91- echo "MINOR_VERSION=${MINOR_VERSION}" >> "$GITHUB_ENV"
9297 echo "CUSTOM_VERSION=${RELEASE}" >> "$GITHUB_ENV"
9398 echo "SENTRY_RELEASE=${RELEASE}" >> "$GITHUB_ENV"
94- echo "ENVIRONMENT=${ENVIRONMENT}" >> "$GITHUB_ENV"
95- echo "BRANCH_NAME =${BRANCH_NAME }" >> "$GITHUB_ENV"
99+ minor_version=$( echo "$VERSION" | sed -n 's#\([0-9]\+\).\([0-9]\+\).*#\1.\2#p')
100+ echo "MINOR_VERSION =${minor_version }" >> "$GITHUB_ENV"
96101
97102 - name : Setup Node
98103 uses : actions/setup-node@v3
@@ -104,7 +109,7 @@ jobs:
104109 id : create-check
105110 uses : ./.github/actions/checks/create-pull-request-check
106111 with :
107- PR_HEAD : " changeset-release/${{env.BRANCH_NAME }}"
112+ PR_HEAD : " changeset-release/${{env.MINOR_VERSION }}"
108113 CHECK_NAME : " Deploy_staging"
109114 STATUS : " in_progress"
110115 TITLE : " Deploy staging"
@@ -159,7 +164,7 @@ jobs:
159164 JOB_STATUS : ${{ job.status }}
160165 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_CLOUD_DEPLOYMENTS_WEBHOOK_URL }}
161166 SLACK_MENTION_GROUP_ID : ${{ secrets.SLACK_DASHBOARD_GROUP_ID }}
162- JOB_TITLE : " Dashboard deployment of ${{ env.CUSTOM_VERSION || env.BRANCH_NAME }} to ${{ env.ENVIRONMENT }}"
167+ JOB_TITLE : " Dashboard deployment of ${{ env.CUSTOM_VERSION || env.VERSION }} to ${{ env.ENVIRONMENT }}"
163168 run : |
164169 python3 ./.github/workflows/notify/notify-slack.py
165170
@@ -189,5 +194,4 @@ jobs:
189194 with :
190195 VERSION : ${{ needs.build.outputs.MINOR_VERSION }} # eg. "3.19"
191196 CUSTOM_VERSION : ${{ needs.build.outputs.CUSTOM_VERSION }} # eg. "3.19.4-5a41d18"
192- BRANCH_NAME : ${{ needs.build.outputs.BRANCH_NAME }}
193197 secrets : inherit
0 commit comments