wip: update to r50 - set the studio workflow #89
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: Node CI | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v**" | |
pull_request: | |
jobs: | |
build-gateways: | |
# TODO - should this be dependant on tests or something passing if we are on a tag? | |
name: Build gateways | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get the Docker tag | |
id: docker-tag | |
uses: yuya-takeyama/docker-tag-from-github-ref-action@2b0614b1338c8f19dd9d3ea433ca9bc0cc7057ba | |
with: | |
remove-version-tag-prefix: false | |
- name: Determine images to publish | |
id: image-tags | |
# TODO - image needs changing... | |
run: | | |
IMAGES= | |
DOCKER_TAG=${{ steps.docker-tag.outputs.tag }} | |
# check if a release branch, or master, or a tag | |
if [[ $DOCKER_TAG =~ ^release([0-9]+)$ || $DOCKER_TAG == "latest" || "${{ github.ref }}" == refs/tags/* ]] | |
then | |
DOCKERHUB_PUBLISH="1" | |
IMAGES="superflytv/sofie-spreadsheet-gateway:$DOCKER_TAG"$'\n'$IMAGES | |
# debug output | |
echo dockerhub-publish $DOCKERHUB_PUBLISH | |
echo images $IMAGES | |
echo ::set-output name=images::"$IMAGES" | |
echo ::set-output name=dockerhub-publish::"$DOCKERHUB_PUBLISH" | |
else | |
echo "Skipping docker build" | |
fi | |
- name: Build libs | |
if: ${{ steps.image-tags.outputs.images }} | |
run: | | |
yarn install | |
yarn build | |
yarn install --prod --ignore-scripts | |
- name: Set up Docker Buildx | |
if: ${{ steps.image-tags.outputs.images }} | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
if: steps.image-tags.outputs.images && steps.image-tags.outputs.dockerhub-publish == '1' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# TODO - do we want this? | |
# - name: Login to GitHub Container Registry | |
# uses: docker/login-action@v1 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.repository_owner }} | |
# password: ${{ secrets.CR_PAT }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
if: ${{ steps.image-tags.outputs.images }} | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.image-tags.outputs.images }} | |
lint-packages: | |
name: Lint Package | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- name: Prepare Environment | |
run: | | |
yarn install | |
yarn build | |
env: | |
CI: true | |
- name: Run typecheck and linter | |
run: | | |
yarn lint | |
env: | |
CI: true |