Skip to content

[NuGet](deps): Bump NCronJob from 4.0.2 to 4.1.0 in the others group … #7

[NuGet](deps): Bump NCronJob from 4.0.2 to 4.1.0 in the others group …

[NuGet](deps): Bump NCronJob from 4.0.2 to 4.1.0 in the others group … #7

Workflow file for this run

name: Automated .NET Release
on:
push:
paths-ignore:
- "**.yml"
branches:
- "main"
- "rel/**"
tags:
- "**"
workflow_dispatch:
permissions:
actions: write
checks: write
contents: write
jobs:
check_for_tag:
name: Check if tag has to be created
if: ${{ contains(github.event.head_commit.message, '[release]') || contains(github.event.head_commit.message, '[pre-release]') }}
uses: ./.github/workflows/tag-creation.yml
extract_meta:
name: Extract metadata for use
if: ${{ contains(github.event.head_commit.message, '[release]') || contains(github.event.head_commit.message, '[pre-release]') }}
runs-on: ubuntu-24.04
outputs:
loc_cs: ${{ steps.loc_cs.outputs.total_lines }}
changelog: ${{ steps.changelog.outputs.changelog }}
datetime: ${{ steps.dateTime.outputs.time }}
clean_version: ${{ steps.get-version.outputs.clean_version }}
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Calculate Lines of Source Code
id: loc_cs
uses: PavanMudigonda/lines-of-code-reporter@6c5507f592136d1c05cb1e8c30889dc4eb5561f5
with:
include_lang: "C#,MSBuild script"
- name: Get correct changelog
id: changelog
run: |
if ${{ contains(github.event.head_commit.message, '[pre-release]') }}; then
echo "changelog=CHANGELOG.previews.md" >> "$GITHUB_OUTPUT"
else
echo "changelog=CHANGELOG.md" >> "$GITHUB_OUTPUT"
fi
- name: Get Date and Time
id: dateTime
uses: Kaven-Universe/github-action-current-date-time@f2c12d90cff9c3e7b1f50430886e632fe31fcee1
with:
format: "YYYY-MM-DDTHH:mm:ss"
- name: Get version from Directory.Build.props
id: get-version
run: |
VERSION=$(grep -oP '(?<=<Version>).*?(?=</Version>)' Directory.Build.props)
echo "version=v$VERSION" >> "$GITHUB_OUTPUT"
echo "clean_version=$VERSION" >> "$GITHUB_OUTPUT"
build-docker:
name: Build docker .zip file
needs: extract_meta
if: ${{ contains(github.event.head_commit.message, '[release]') || contains(github.event.head_commit.message, '[pre-release]') }}
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Getting all files together
run: |
mkdir docker-zip
mv ./${{ needs.extract_meta.outputs.changelog }} ./docker-zip/CHANGELOG.md
mv ./docker-compose.yml ./docker-zip/docker-compose.yml
mv ./LICENSE ./docker-zip/LICENSE
mv ./README.md ./docker-zip/README.md
mv ./SECURITY.md ./docker-zip/SECURITY.md
mkdir -p ./docker-zip/AzzyBot/Logs
mkdir -p ./docker-zip/AzzyBot/Modules/AzuraCast/Files
mkdir -p ./docker-zip/AzzyBot/Modules/MusicStreaming/Files
mv ./src/AzzyBot.Bot/Modules/MusicStreaming/Files/application.yml ./docker-zip/AzzyBot/Modules/MusicStreaming/Files/application.yml
#wget -qO ./docker-zip/AzzyBot/Modules/MusicStreaming/Files/plugins/java-lyrics-plugin-1.6.4.jar https://maven.lavalink.dev/releases/me/duncte123/java-lyrics-plugin/1.6.4/java-lyrics-plugin-1.6.4.jar
mkdir -p ./docker-zip/AzzyBot/Settings
mv ./src/AzzyBot.Bot/Settings/AzzyBotSettings-Docker.json ./docker-zip/AzzyBot/Settings/AzzyBotSettings-Docker.json
- name: Archive docker-zip artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: ${{ needs.extract_meta.outputs.clean_version }}-docker
path: ./docker-zip
create_release:
name: Create GitHub Release
needs: [extract_meta, build-docker]
runs-on: ubuntu-24.04
outputs:
release_version: ${{ steps.set_output.outputs.release_version }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Extract Latest Changelog Entry
id: extract_changelog
run: |
# Extract the latest changelog entry from the changelog file
latest_entry=$(awk 'BEGIN {found=0} /^## / {if (found) exit; found=1} {if (found) print}' ${{ needs.extract_meta.outputs.changelog }})
echo "$latest_entry" > latest_changelog.md
# Extract title for release
release_title=$(echo "$latest_entry" | awk 'NR==2')
# Ensure safe output handling for multiline strings
echo "latest_entry<<EOF" >> "$GITHUB_OUTPUT"
echo "$latest_entry" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
echo "release_title=$release_title" >> "$GITHUB_ENV"
- name: Create Release
id: create_release_action
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.extract_meta.outputs.version }}
name: ${{ needs.extract_meta.outputs.clean_version }}
body_path: latest_changelog.md
prerelease: ${{ contains(github.event.head_commit.message, '[pre-release]') }}
- name: Set Release Version Output
id: set_output
run: |
echo "release_version=${{ needs.extract_meta.outputs.version }}" >> "$GITHUB_OUTPUT"
upload_assets:
name: Upload GitHub Release Assets
needs: [build-docker, create_release]
runs-on: ubuntu-24.04
steps:
- name: Install GitHub CLI
run: sudo apt-get update && sudo apt-get install -y gh
- name: Download and Upload All Artifacts
run: |
# Fetch a list of all artifact details for the current workflow run
ARTIFACTS_JSON=$(gh api /repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts)
# Ensure the command above is successful and returns valid JSON before proceeding
# Iterate over each artifact to download and upload it
echo "$ARTIFACTS_JSON" | jq -c '.artifacts[]' | while read -r artifact; do
ARTIFACT_NAME=$(echo "$artifact" | jq -r '.name')
ARTIFACT_DOWNLOAD_URL=$(echo "$artifact" | jq -r '.archive_download_url')
# Download the artifact
curl -L -o "${ARTIFACT_NAME}.zip" -H "Authorization: token $GITHUB_TOKEN" "$ARTIFACT_DOWNLOAD_URL"
# Upload the artifact to the release
gh release upload ${{ needs.create_release.outputs.release_version }} "${ARTIFACT_NAME}.zip" --clobber --repo ${{ github.repository }}
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}