Skip to content

Publish new images for "main" triggered by kacperzuk-neti #18

Publish new images for "main" triggered by kacperzuk-neti

Publish new images for "main" triggered by kacperzuk-neti #18

name: Publish new build
run-name: Publish new images for "${{ github.ref_name }}" triggered by ${{ github.actor }}
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
workflow_dispatch:
inputs:
version:
description: 'Enter the version number'
required: true
default: 'latest'
jobs:
code-check:
uses: ./.github/workflows/code-check.yml
secrets: inherit
bump-version:
runs-on: ubuntu-latest
needs: code-check
if: ${{ github.ref_name == 'main' && inputs.version != '' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install cargo-edit
run: cargo install cargo-edit
- name: Update version
run: cargo set-version ${{ inputs.version }}
- name: Run cargo check
run: cargo check
- name: Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Commit version change
run: |
git commit -am "Update version to ${{ inputs.version }}"
git push origin main
build-and-publish:
needs:
- code-check
- bump-version
if: |
always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/build-docker-image.yml
with:
version: ${{ inputs.version }}
secrets: inherit
git-tag:
runs-on: ubuntu-latest
needs: build-and-publish
if: |
${{ github.ref_name == 'main' && inputs.version != '' }} &&
always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create and push tag
run: |
TAG_NAME="v${{ inputs.version }}"
git tag $TAG_NAME
git push origin $TAG_NAME