name: Create Release on: push: tags: ['v*'] permissions: contents: write jobs: release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get version info id: version run: | CURRENT_TAG=${GITHUB_REF#refs/tags/} VERSION=${CURRENT_TAG#v} echo "tag=$CURRENT_TAG" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT # Get previous tag PREV_TAG=$(git tag --sort=-v:refname | grep -A1 "^${CURRENT_TAG}$" | tail -1) if [ "$PREV_TAG" = "$CURRENT_TAG" ]; then PREV_TAG="" fi echo "previous_tag=$PREV_TAG" >> $GITHUB_OUTPUT - name: Generate release template run: | cat > release_notes.md << 'EOF' ## What's New ### New Features - **Feature Name**: Description of the feature ### Improvements - **Improvement**: Description ### Where to Find It --- ## Docker Images ```bash docker pull ghcr.io/danielvolz/medassist-ng-backend:${{ steps.version.outputs.version }} docker pull ghcr.io/danielvolz/medassist-ng-frontend:${{ steps.version.outputs.version }} ``` **Full Changelog**: https://github.com/DanielVolz/medassist-ng/compare/${{ steps.version.outputs.previous_tag }}...${{ steps.version.outputs.tag }} EOF - name: Create Draft Release uses: softprops/action-gh-release@v1 with: body_path: release_notes.md draft: true generate_release_notes: false name: "Release ${{ steps.version.outputs.tag }}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}