Add verification action if the image is using latest version (#3132)

This commit is contained in:
Michal Widera 2023-02-13 11:07:27 +01:00 committed by GitHub
parent 0af551eab0
commit 987196635a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@ name: Deploy to staging demo
on: on:
push: push:
tags: tags:
- 3.11.** - 3.**
workflow_dispatch: workflow_dispatch:
inputs: inputs:
git_ref: git_ref:
@ -10,7 +10,7 @@ on:
required: true required: true
jobs: jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
env: env:
API_URI: /graphql/ API_URI: /graphql/
APP_MOUNT_URI: /dashboard/ APP_MOUNT_URI: /dashboard/
@ -23,10 +23,23 @@ jobs:
APPS_MARKETPLACE_API_URI: "https://apps.staging.saleor.io/api/v2/saleor-apps" APPS_MARKETPLACE_API_URI: "https://apps.staging.saleor.io/api/v2/saleor-apps"
ENVIRONMENT: demo-staging ENVIRONMENT: demo-staging
DEMO_MODE: true DEMO_MODE: true
NOTIFY: true
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
ref: ${{ github.event.inputs.git_ref || '' }} ref: ${{ github.event.inputs.git_ref || '' }}
- name: Check version
run: |
export GITHUB_TOKEN=$( \
curl --request GET --url ${{ secrets.VAULT_URL}} --header "Authorization: JWT ${{ secrets.VAULT_JWT }}" | jq -r .token \
)
version=${{ github.event.inputs.git_ref || github.ref_name }}
latest_version=$(gh api -H "Accept: application/vnd.github+json" --jq .name /repos/saleor/saleor-dashboard/releases/latest)
if ! [[ $version != $latest_version ]]; then
echo "Unsupported version: $version"
echo "NOTIFY=false" >> $GITHUB_ENV
exit 1
fi
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
@ -64,7 +77,7 @@ jobs:
} }
}' }'
- name: Notify Slack - name: Notify Slack
if: ${{ always() }} if: ${{ always() && env.NOTIFY }}
env: env:
JOB_DEPLOYMENT_KIND: production JOB_DEPLOYMENT_KIND: production
JOB_STATUS: ${{ job.status }} JOB_STATUS: ${{ job.status }}