Skip to content

fix: properly check for GitHub org (#231) #140

fix: properly check for GitHub org (#231)

fix: properly check for GitHub org (#231) #140

on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
name: ci
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js 14.x
uses: actions/setup-node@master
with:
node-version: 14.x
- run: npm ci
- run: npm run lint
- run: npm run test
build_and_publish_docker_image:
needs: test
runs-on: ubuntu-latest
env:
IMAGE: italia/developers-italia-onboarding
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get Docker image tags
run: |
TAGS=${IMAGE}:$(echo ${GITHUB_REF##*/})
TAGS="$TAGS,${IMAGE}:${GITHUB_SHA::8}"
echo "TAGS=${TAGS}" >> $GITHUB_ENV
- name: Add latest tag to Docker image on release
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAGS=$(echo "${{ env.TAGS }}")
TAGS="$TAGS,${IMAGE}:latest"
echo "TAGS=${TAGS}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.TAGS }}