0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-06-30 02:31:08 +00:00

feat: Add release workflow and changelog

This commit is contained in:
alex289 2024-04-26 10:51:43 +02:00
parent 6a53c747aa
commit 1a80a7a258
No known key found for this signature in database
GPG Key ID: 573F77CD2D87F863
3 changed files with 70 additions and 4 deletions

View File

@ -4,6 +4,8 @@ on:
workflow_dispatch:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
@ -38,7 +40,7 @@ jobs:
cd:
runs-on: ubuntu-latest
needs: ci
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
@ -67,9 +69,7 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ env.DOCKER_IMAGE }}:latest
${{ env.DOCKER_IMAGE }}:${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4

56
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: Release
on:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: calculate version
id: calculate-version
uses: bitshifted/git-auto-semver@v1
- name: Get previous tag
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate | tail -2 | head -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- name: Create new tag
run: |
git tag -a ${{ steps.calculate-version.outputs.version-string }} -m "Release ${{ steps.calculate-version.outputs.version-string }}"
git push origin ${{ steps.calculate-version.outputs.version-string }}
git checkout main
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ github.calculate-version.outputs.version-string }}
toTag: ${{ env.previousTag }}
- name: Create Release
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.calculate-version.outputs.version-string }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.calculate-version.outputs.version-string }} [skip ci]'
file_pattern: CHANGELOG.md

10
CHANGELOG.md Normal file
View File

@ -0,0 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.0] - 2024-03-23
_This is the initial release._
[v1.0.0]: https://github.com/alex289/CleanArchitecture/commits/v1.0.0