fix type streamServerClient.upsertUser lasdeloy to Vercel #126
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
tags: | |
# Matches stable and pre-releases | |
- "[0-9]+.[0-9]+.[0-9]+*" | |
branches: | |
- main | |
- ci/** | |
jobs: | |
docker: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# Outputs the name of the repository (owner/repo) | |
- name: Build Image Name | |
id: image | |
run: | | |
# The name of the owner and of the repository: owner/repository | |
IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') | |
echo ::set-output name=image_name::${IMAGE_NAME} | |
# Outputs container tags for tagged pushes starting by 'v' | |
# Pushes only to GitHub Container Repository (ghcr.io) | |
# | |
# Tags stable versions as :latest | |
# Pre-releases, alphas, etc. as :snapshot | |
- name: Prepare Image Tags from Git Tag | |
id: tagged | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
set -x | |
# Remove everything else than the tagged version | |
VERSION=${GITHUB_REF#refs/tags/} | |
# Tag as stable (:latest) if there is no letters in the version | |
# Otherwise, tag as preview (:snapshot) | |
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
# Matches 1.0.0, 1.0.1, etc. | |
NAMED_VERSION="latest" | |
else | |
# Matches 1.0.0a1, 1.0.0rc1, etc. | |
NAMED_VERSION="snapshot" | |
fi | |
TAGS=$"\ | |
ghcr.io/${{ steps.image.outputs.image_name }}:${NAMED_VERSION},\ | |
ghcr.io/${{ steps.image.outputs.image_name }}:${VERSION}\ | |
" | |
# Output the target tags | |
echo " | |
CONTAINER_TAGS=${TAGS} | |
NAMED_VERSION=${NAMED_VERSION} | |
VERSION=${VERSION} | |
" >> "${GITHUB_ENV}" | |
# Outputs the containers tags for staging branches | |
# Only publishes them onto Docker Hub | |
- name: Prepare Tags for Staging | |
id: staging | |
if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
run: | | |
set -x | |
# Version name is the branch name | |
# Slashes are substitued by dashes | |
CLEAN_BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -) | |
# Target GHCR with the branch name as the tag, e.g. unstable-main | |
TAGS=$"\ | |
ghcr.io/${{ steps.image.outputs.image_name }}:unstable-${CLEAN_BRANCH_NAME} | |
" | |
# Set version name for open-containers version label as: | |
# <branch>-<drift>-g<6-digit-hash> | |
NAMED_VERSION=$(git describe --all --long | tr -d $'\n') | |
# Output the target tags | |
echo " | |
CONTAINER_TAGS=${TAGS} | |
NAMED_VERSION=${NAMED_VERSION} | |
" >> "${GITHUB_ENV}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
# This condition is a temporary fix until | |
# https://github.com/docker/buildx/issues/1044 is resolved, as it | |
# prevents usage of image registry. | |
# Due to limitation of local cache size we are skipping main branch and | |
# prioritize local cache for other branches e.g 3.x. | |
if: github.ref != 'refs/heads/main' | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ hashFiles('requirements_dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CR_USERNAME }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build and Push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: ./ | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.CONTAINER_TAGS }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
build-args: | | |
PROJECT_VERSION=${{ env.NAMED_VERSION }} | |
COMMIT_ID=${{ github.sha }} | |
- name: Image digest | |
run: | | |
echo $"\ | |
Digest: ${{ steps.docker_build.outputs.digest }} | |
Tags: ${{ env.CONTAINER_TAGS }}" | |
- name: Trigger staging deployments for tagged release | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
curl -f -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: Bearer ${{ secrets.SALEOR_RELEASE_TOKEN }}" \ | |
https://api.github.com/repos/saleor/saleor-multitenant/dispatches \ | |
-d "{\"event_type\":\"deploy-staging\",\"client_payload\":{\"version\":\"$VERSION\"}}" | |
curl -f -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: Bearer ${{ secrets.SALEOR_RELEASE_TOKEN }}" \ | |
https://api.github.com/repos/saleor/saleor-cloud-deployments/dispatches \ | |
-d "{\"event_type\":\"deploy-demo-staging\",\"client_payload\":{\"version\":\"$VERSION\"}}" |