Skip to content

Update docker-image.yml #8

Update docker-image.yml

Update docker-image.yml #8

Workflow file for this run

#name: Docker Image CI
#
#on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
#
#jobs:
#
# build:
#
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v3
# - name: Build the Docker image
# run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
name: Release
on:
push:
branches:
- 'main'
concurrency:
group: ${{ github.ref_name }} # for the same branch
cancel-in-progress: true # run only one workflow at a time (cancel the previous)
permissions:
contents: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-and-release:
name: Build and release
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
outputs:
release_id: ${{ steps.create_release.outputs.id }}
released_version: ${{ steps.release_version.outputs.version }}
runs-on: ubuntu-latest
steps:
- name: Build docker image
uses: actions/checkout@v3
with:
script: |
docker build .
build-and-release-docker:
name: Build and release Docker image
permissions:
packages: write
needs: build-and-release
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Resolve new release version
id: release_version
uses: codacy/[email protected]
with:
prefix: 'v'
minor-identifier: '/feat(?:\\([^)]+\\))?:/'
major-identifier: '(breaking)' # this should be placed somewhere in the commit message like "feat: (breaking) some message"
- name: Log in to Docker hub
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build-and-release.outputs.released_version }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest