Skip to content

Build and publish app #36

Build and publish app

Build and publish app #36

Workflow file for this run

name: Build and publish app
on:
workflow_dispatch:
push:
env:
REGISTRY: severalnines
IMAGE: ${{ github.event.repository.name }}
jobs:
build-publish:
name: Build, Publish
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ env.REGISTRY }}
password: ${{ secrets.DH_PASS }}
- name: Build docker image
run: |-
docker build \
--tag "$REGISTRY/$IMAGE:build-$GITHUB_RUN_NUMBER" \
--tag "$REGISTRY/$IMAGE:latest" \
-f Dockerfile \
.
- name: Publish docker image
run: |-
docker push "$REGISTRY/$IMAGE:build-$GITHUB_RUN_NUMBER"
docker push "$REGISTRY/$IMAGE:latest"
if: github.ref_name == 'main'