Skip to content

Modify name of workflow #68

Modify name of workflow

Modify name of workflow #68

Workflow file for this run

name: Deploy to Container Registry
on:
push:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
create-tag-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check.outputs.version }}
tag-exists: ${{ steps.create-tag-release.outputs.tag-exists }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check version
id: check
shell: bash
run: |
PPREVIOUS_VERSION=$(git show HEAD~1:Cargo.toml | grep version -m 1 | cut -d '"' -f 2)
CURRENT_VERSION=$(grep version Cargo.toml -m 1 | cut -d '"' -f 2)
if [ "$PPREVIOUS_VERSION" != "$CURRENT_VERSION" ]; then
echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
fi
- name: Create tag and release
id: create-tag-release
if: ${{ steps.check.outputs.version != '' }}
uses: marshallku/actions/version/generate@master
with:
tag: v${{ steps.check.outputs.version }}
push-image:
runs-on: ubuntu-latest
needs: ["create-tag-release"]
if: ${{ needs.create-tag-release.outputs.tag-exists == 'false' }}
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ needs.create-tag-release.outputs.version }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}