mocksaml/.github/workflows/docker-publish.yml
Kiran K fdaa190df4
Add Github actions (#15)
* Add Github actions

* Fix the docker build issue

* Remove the duplicate Github action

* only need runtime env vars during build

* ENV NEXT_TELEMETRY_DISABLED is a runtime env var

* Add missing keys to package.json

* Use the npm version as tag

Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com>
2022-03-10 17:20:33 +00:00

48 lines
1.3 KiB
YAML

name: Build and Publish Docker
on:
push:
branches:
- 'main'
jobs:
build-and-push-docker-image:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- run: |
npm install -g json
MOCK_SAML_VERSION=$(echo $(cat ./package.json) | json version)
echo "::set-output name=npmversion::$(echo ${MOCK_SAML_VERSION})"
id: npmversion
- name: Get short SHA
id: slug
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
if: github.ref == 'refs/heads/release'
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ github.repository }}:latest,${{ github.repository }}:${{ steps.slug.outputs.sha7 }},${{ github.repository }}:${{ steps.npmversion.outputs.npmversion }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}