-
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (101 loc) · 3.37 KB
/
deploy.yml
File metadata and controls
111 lines (101 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Deploy
on:
workflow_call:
inputs:
os:
description: "The OS the workflow should use"
required: false
type: string
default: ubuntu-latest
retention_days:
description: "Artifact retention days"
required: false
type: number
default: 7
draft:
description: "Whether to create a draft release"
required: false
type: boolean
default: false
prerelease_suffix:
description: "Pattern to identify pre-releases (default: -RC)"
required: false
type: string
default: '-RC'
permissions:
contents: write
jobs:
deploy:
name: "Release"
runs-on: ${{ inputs.os }}
steps:
# Download the release artifacts uploaded in the previous workflow
- name: Download Artifacts
uses: actions/download-artifact@v5
id: download
continue-on-error: false
with:
name: Release
run-id: ${{ github.event.workflow_run.id }}
path: "${{ github.workspace }}/tmp/"
# Verify artifacts were downloaded successfully
- name: Verify Artifacts
shell: bash
run: |
# Check if the tmp directory exists and has files
if [ ! -d "${{ github.workspace }}/tmp/" ] || [ -z "$(ls -A ${{ github.workspace }}/tmp/)" ]; then
echo "::error::No artifacts found in download directory"
exit 1
fi
# List all downloaded artifacts for logging
echo "Downloaded artifacts:"
ls -la ${{ github.workspace }}/tmp/
# Count the number of artifacts
ARTIFACT_COUNT=$(ls -1 ${{ github.workspace }}/tmp/ | wc -l)
echo "artifact_count=$ARTIFACT_COUNT" >> $GITHUB_OUTPUT
if [ "$ARTIFACT_COUNT" -eq 0 ]; then
echo "::error::No artifacts found after download"
exit 1
fi
echo "Found $ARTIFACT_COUNT artifacts"
# Generate changelog
- name: Generate Changelog
uses: ardalanamini/auto-changelog@v4
id: changelog
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-types: |
feat: New Features
fix: Bug Fixes
build: Build System & Dependencies
perf: Performance Improvements
docs: Documentation
test: Tests
refactor: Refactors
chore: Chores
ci: CI
style: Code Style
revert: Reverts
default-commit-type: Other Changes
release-name: ${{ github.ref_name }}
mention-authors: true
mention-new-contributors: true
include-compare-link: true
include-pr-links: true
include-commit-links: true
semver: true
use-github-autolink: true
# Create release
- name: Create Release
uses: softprops/action-gh-release@v2
id: create-release
with:
files: |
${{ github.workspace }}/tmp/*
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref_name }}
draft: ${{ inputs.draft }}
prerelease: ${{ contains(github.ref_name, inputs.prerelease_suffix) }}
generate_release_notes: false
body: ${{ steps.changelog.outputs.changelog }}