0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-06-29 18:21:08 +00:00
CleanArchitecture/.github/workflows/release.yml
dependabot[bot] fe87087cda
chore: bump ncipollo/release-action in the dependencies group
Bumps the dependencies group with 1 update: [ncipollo/release-action](https://github.com/ncipollo/release-action).


Updates `ncipollo/release-action` from 1.15.0 to 1.16.0
- [Release notes](https://github.com/ncipollo/release-action/releases)
- [Commits](https://github.com/ncipollo/release-action/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: ncipollo/release-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-01 06:05:57 +00:00

141 lines
4.6 KiB
YAML

name: Release
on:
workflow_dispatch:
env:
DOCKER_IMAGE: alexdev28/clean-architecture
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get next version
id: get_next_version
uses: thenativeweb/get-next-version@main
with:
prefix: 'v'
- name: Show the next version
run: |
echo ${{ steps.get_next_version.outputs.version }}
echo ${{ steps.get_next_version.outputs.hasNextVersion }}
- name: Get previous tag
id: previousTag
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: |
name=$(git --no-pager tag --sort=creatordate | tail -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- name: Create new tag
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a ${{ steps.get_next_version.outputs.version }} -m "Release ${{ steps.get_next_version.outputs.version }}"
git push origin ${{ steps.get_next_version.outputs.version }}
git checkout main
- name: Update CHANGELOG
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ steps.get_next_version.outputs.version }}
toTag: ${{ env.previousTag }}
- name: Create Release
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: ncipollo/release-action@v1.16.0
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ steps.get_next_version.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.get_next_version.outputs.version }}
- name: Create Changelog Pull Request
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PAT }}
branch: release/${{ steps.get_next_version.outputs.version }}
title: 'docs: update CHANGELOG.md for ${{ steps.get_next_version.outputs.version }}'
commit-message: 'docs: update CHANGELOG.md for ${{ steps.get_next_version.outputs.version }}'
labels: changelog
body: |
This PR updates the CHANGELOG.md file for the release of version ${{ steps.get_next_version.outputs.version }}.
deploy:
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get previous tag
id: latestTag
run: |
name=$(git --no-pager tag --sort=creatordate | tail -1)
git checkout $name
echo "latestTag: $name"
echo "latestTag=$name" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
tags: |
type=semver,pattern={{version}},value=${{ steps.latestTag.outputs.latestTag }}
images: |
${{ env.DOCKER_IMAGE }}
ghcr.io/${{ github.repository }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.DOCKER_IMAGE }}
readme-filepath: ./Readme.md