Skip to content

gk

gk #29

Workflow file for this run

name: Build Image
on:
push:
branches:
- main
- ec2-ami
workflow_dispatch:
pull_request:
types:
- closed
branches:
- main
- dev
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
IMAGE_TAG: <WILL_BE_SET>
jobs:
build:
name: Build
runs-on: ubuntu-latest
# if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
RELEASE_BRANCHES: dev
DEFAULT_BUMP: patch
id: tag_action
- name: Set IMAGE_TAG
run: |
echo "IMAGE_TAG=${{ steps.tag_action.outputs.new_tag }}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v3
with:
context: ./server
push: true
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }},${{ env.IMAGE_NAME }}:latest
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max