Skip to content

Merge pull request #40 from evrone-erp/release/v2.2.0 #29

Merge pull request #40 from evrone-erp/release/v2.2.0

Merge pull request #40 from evrone-erp/release/v2.2.0 #29

Workflow file for this run

name: Build & Push
on:
push:
branches:
- 'master'
- 'develop'
- 'release/**'
tags:
- v**
env:
IMAGE_NAME: ${{ github.event.repository.name }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set version
id: set-version
run: |
if ${{ contains(github.ref, 'develop') }}; then
VERSION=staging-${GITHUB_SHA::8}-$(date +%s)
fi
if ${{ contains(github.ref, 'release/v') || contains(github.ref, 'master') }}; then
VERSION=qa-${GITHUB_SHA::8}-$(date +%s)
fi
if ${{ contains(github.ref, 'tags/v') }}; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ steps.set-version.outputs.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GA_NPM_TOKEN=${{ secrets.GA_PACKAGES_TOKEN_READ }}