ansible-collection/.forgejo/workflows/Create Release.yml

100 lines
3.6 KiB
YAML

# Ansible Roles for managing Auengun.net Infrastructure & Testing/Learning.
# Source available at git.auengun.net/homelab/ansible-collection
# Copyright (C) 2023 GregoryDosh
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-FileCopyrightText: 2023 GregoryDosh
---
name: Create Release
on:
push:
branches:
- main
paths:
- galaxy.yml
jobs:
create-release:
name: Create Release
runs-on: ubuntu-act-latest
if: ${{ secrets.REPO_PUBLISH_TOKEN != '' }}
steps:
- name: Clone Repo into Workspace
uses: https://git.auengun.net/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
fetch-tags: true
- name: Create Env Vars
shell: bash
run: |
{
printf "RELEASE_TAG="
grep version: galaxy.yml | cut -f 2 -d":" | sed -e 's/^[[:space:]]*//'
} >> "$GITHUB_ENV"
{
printf "RELEASE_PREV_TAG="
git describe `git rev-list --tags --no-walk --skip=0` --tags --exact-match | head -n 1
} >> "$GITHUB_ENV"
{
printf "COMMITS_SINCE_TAG="
git rev-list `git rev-list --tags --no-walk --skip=1 --max-count=1`..HEAD --count
} >> "$GITHUB_ENV"
cat "$GITHUB_ENV"
- name: Create Release Notes
id: release_notes
shell: bash
run: |
{
echo "RELEASE_NOTES<<EOF"
git log -n ${{ env.COMMITS_SINCE_TAG }} --pretty=%B | grep -v "chore(release)"
echo "EOF"
} >> "$GITHUB_OUTPUT"
echo "Saved to $GITHUB_OUTPUT"
- name: Create Release & Vet License Headers
id: create_release
shell: bash
run: |
make release
{
echo "RELEASE_SHA<<EOF"
cat release/ansible-colllection.zip.sha256
echo "EOF"
} >> "$GITHUB_OUTPUT"
echo "Saved to $GITHUB_OUTPUT"
- name: Create Release
uses: https://git.auengun.net/actions/forgejo-release@fc0488c944626f9265d87fbc4dd6c08f78014c63 # v2.7.3
with:
token: ${{ secrets.REPO_PUBLISH_TOKEN }}
direction: upload
override: true
release-dir: release
tag: ${{ env.RELEASE_TAG }}
title: ${{ env.RELEASE_TAG }}
hide-archive-link: true
release-notes: |
# [Release ${{ env.RELEASE_TAG }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }})
${{ steps.release_notes.outputs.RELEASE_NOTES }}
**sha256** `${{ steps.create_release.outputs.RELEASE_SHA }}`
---
[${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) ${{ github.server_url }}/${{ github.repository }}/src/commit/${{ github.sha }} [${{ env.RELEASE_PREV_TAG }}...${{ env.RELEASE_TAG }}](${{ github.server_url }}/${{ github.repository }}/compare/${{ env.RELEASE_PREV_TAG }}...${{ env.RELEASE_TAG }})