fix: properly check for GitHub org (#231) #140
Workflow file for this run
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
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 }} |