Skip to content

Pontoon: Update Saraiki (skr) localization of Common Voice #16254

Pontoon: Update Saraiki (skr) localization of Common Voice

Pontoon: Update Saraiki (skr) localization of Common Voice #16254

Workflow file for this run

name: Build and Push Docker container
on:
push:
branches:
- main
tags:
- 'release-v*.*.*'
- 'stage-v*.*.*'
- 'sandbox-v*.*.*'
jobs:
test-server:
# Exclude Pontoon commits from building a new Docker container
if: ${{ contains(github.ref, '-v') || !contains(github.event.head_commit.message, 'Pontoon:')}}
# Build Docker image if tagged w/ a version
# if: "contains(github.ref, '-v')"
services:
mysql:
image: mysql:5.7
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_USER: voicecommons
MYSQL_PASSWORD: voicecommons
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Run application tests
run: |
yarn install --frozen-lockfile
yarn test
docker:
runs-on: ubuntu-latest
needs: test-server
steps:
- name: docker-tags
id: tags
run: |
DOCKER_IMAGE=mozilla/commonvoice
VERSION=noop
TAG_TS=$(date +%s)
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=main-${GITHUB_SHA}-${TAG_TS}
fi
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*}
MAJOR=${MINOR%.*}
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup docker environment
uses: docker/setup-buildx-action@v2
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
file: ./docker/Dockerfile
tags: ${{ steps.tags.outputs.tags }}
build-args: |
COMMIT=${{ github.sha }}
TAG=${{ steps.tags.outputs.tags }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}