Release every push to release branches to staging (#3566)
This commit is contained in:
parent
2c200af0dd
commit
13fd9f43a2
1 changed files with 19 additions and 2 deletions
21
.github/workflows/deploy-staging.yaml
vendored
21
.github/workflows/deploy-staging.yaml
vendored
|
@ -4,11 +4,19 @@ on:
|
||||||
tags:
|
tags:
|
||||||
# Matches stable and pre-releases
|
# Matches stable and pre-releases
|
||||||
- "[0-9]+.[0-9]+.[0-9]+*"
|
- "[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
branches:
|
||||||
|
# Matches release branches
|
||||||
|
- "[0-9]+.[0-9]+"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
git_ref:
|
git_ref:
|
||||||
description: Git ref (tag, branch or commit hash) with helm chart to deploy
|
description: Git ref (tag, branch or commit hash) to deploy
|
||||||
required: true
|
required: true
|
||||||
|
trigger_release:
|
||||||
|
type: boolean
|
||||||
|
description: "Trigger release"
|
||||||
|
required: true
|
||||||
|
default: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -37,6 +45,14 @@ jobs:
|
||||||
environment=$(echo $VERSION | sed -n 's#\([0-9]\+\).\([0-9]\+\).*#saleor-staging-v\1\2#p')
|
environment=$(echo $VERSION | sed -n 's#\([0-9]\+\).\([0-9]\+\).*#saleor-staging-v\1\2#p')
|
||||||
echo "ENVIRONMENT=${environment}" >> $GITHUB_ENV
|
echo "ENVIRONMENT=${environment}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set custom version
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/heads/') }}
|
||||||
|
# Add commit hash to basic version number
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
hash=$(git rev-parse --short HEAD)
|
||||||
|
echo "CUSTOM_VERSION=${VERSION}-${hash}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
@ -65,6 +81,7 @@ jobs:
|
||||||
for i in {1..3}; do aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DIST_ID }} --paths "/dashboard*" && break || sleep 5; done
|
for i in {1..3}; do aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DIST_ID }} --paths "/dashboard*" && break || sleep 5; done
|
||||||
|
|
||||||
- name: Prepare Sandbox release pull request
|
- name: Prepare Sandbox release pull request
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event.inputs.trigger_release == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
export GITHUB_TOKEN=$( \
|
export GITHUB_TOKEN=$( \
|
||||||
curl --request GET --url ${{ secrets.VAULT_URL}} --header "Authorization: JWT ${{ secrets.VAULT_JWT }}" | jq -r .token \
|
curl --request GET --url ${{ secrets.VAULT_URL}} --header "Authorization: JWT ${{ secrets.VAULT_JWT }}" | jq -r .token \
|
||||||
|
@ -86,6 +103,6 @@ jobs:
|
||||||
JOB_STATUS: ${{ job.status }}
|
JOB_STATUS: ${{ job.status }}
|
||||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLOUD_DEPLOYMENTS_WEBHOOK_URL }}
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLOUD_DEPLOYMENTS_WEBHOOK_URL }}
|
||||||
SLACK_MENTION_GROUP_ID: ${{ secrets.SLACK_DASHBOARD_GROUP_ID }}
|
SLACK_MENTION_GROUP_ID: ${{ secrets.SLACK_DASHBOARD_GROUP_ID }}
|
||||||
JOB_TITLE: "Dashboard deployment to ${{ env.ENVIRONMENT }}"
|
JOB_TITLE: "Dashboard deployment of ${{ env.CUSTOM_VERSION || env.VERSION }} to ${{ env.ENVIRONMENT }}"
|
||||||
run: |
|
run: |
|
||||||
python3 ./.github/workflows/notify/notify-slack.py
|
python3 ./.github/workflows/notify/notify-slack.py
|
||||||
|
|
Loading…
Reference in a new issue