Update node base image, bcgovpubcode and test pipelines #83
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
--- | |
name: Docker Image CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
pull_request: | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: app | |
outputs: | |
HAS_DOCKER_SECRETS: ${{ steps.check-secrets.outputs.HAS_DOCKER_SECRETS }} | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Check Workflow Secrets | |
id: check-secrets | |
run: | | |
echo "::set-output name=HAS_DOCKER_SECRETS::${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}" | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag common-document-generation-service:$(date +%s) | |
docker-publish: | |
needs: docker-build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: app | |
timeout-minutes: 10 | |
if: github.event_name != 'pull_request' && needs.docker-build.outputs.HAS_DOCKER_SECRETS == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: bcgovimages/common-document-generation-service | |
# Creates tags based off of branch names and semver tags | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
# Always updates the 'latest' tag | |
flavor: | | |
latest=true | |
- name: Build and Push to DockerHub | |
uses: docker/build-push-action@v2 | |
with: | |
context: app | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Inspect Docker Image | |
run: docker image inspect bcgovimages/common-document-generation-service:latest |