Update docker-image.yml #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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-docker: | |
name: Build and release Docker image | |
permissions: | |
packages: write | |
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: latest |