1
+ name : Generate Release Notes and Upload
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - pre-release
7
+
8
+ permissions :
9
+ contents : write
10
+
11
+ jobs :
12
+ release :
13
+ if : github.event.repository.fork == false && github.event_name == 'push'
14
+ name : Generate Release Notes and Upload to Azure
15
+ runs-on : ubuntu-latest
16
+
17
+ steps :
18
+ # Checkout the repository
19
+ - name : Checkout Code
20
+ uses : actions/checkout@v3
21
+
22
+ # Read and Trim Version
23
+ - name : Read and Trim Version
24
+ id : get_version
25
+ run : |
26
+ if [ ! -f version_latest.txt ]; then
27
+ echo "Error: version_latest.txt not found!"
28
+ exit 1
29
+ fi
30
+ VERSION=$(cat version_latest.txt | tr -d '[:space:]')
31
+ if [ -z "$VERSION" ]; then
32
+ echo "Error: version_latest.txt is empty after trimming!"
33
+ exit 1
34
+ fi
35
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
36
+
37
+ # Exit if Tag Already Exists
38
+ - name : Check if Tag Exists
39
+ id : tag_check
40
+ run : |
41
+ git fetch --tags
42
+ if git rev-parse "refs/tags/${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
43
+ echo "tag_exists=true" >> $GITHUB_ENV
44
+ echo "Tag ${{ steps.get_version.outputs.version }} already exists. Exiting workflow successfully."
45
+ else
46
+ echo "tag_exists=false" >> $GITHUB_ENV
47
+ fi
48
+
49
+ # Generate Release Notes
50
+ - name : Generate Release Notes
51
+ id : changelog
52
+ if : env.tag_exists == 'false'
53
+
54
+ with :
55
+ configuration : .github/release-changelog-config.yml
56
+ env :
57
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58
+
59
+ # Create a new release tag
60
+ - name : Create GitHub Release
61
+ if : env.tag_exists == 'false'
62
+
63
+ with :
64
+ tag : ${{ steps.get_version.outputs.version }}
65
+ name : " v${{ steps.get_version.outputs.version }}"
66
+ draft : false
67
+ prerelease : true
68
+ body : ${{ steps.changelog.outputs.changelog }}
69
+ env :
70
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71
+
72
+ # Create ZIP File in a New Source Directory
73
+ - name : Prepare and Zip Release Files
74
+ if : env.tag_exists == 'false'
75
+ run : |
76
+ mkdir -p src/releases
77
+ zip -r src/releases/release_${{ steps.get_version.outputs.version }}.zip . \
78
+ --exclude "./src/releases/*" \
79
+ --exclude ".*" \
80
+ --exclude ".*/**"
81
+ zip -r src/releases/beta.zip . \
82
+ --exclude "./src/releases/*" \
83
+ --exclude ".*" \
84
+ --exclude ".*/**"
85
+
86
+ # Upload to Azure Blob Storage
87
+ - name : Azure Blob Upload with Destination folder defined
88
+ if : env.tag_exists == 'false'
89
+ uses :
LanceMcCarthy/[email protected]
90
+ with :
91
+ connection_string : ${{ secrets.AZURE_CONNECTION_STRING }}
92
+ container_name : cipp-releases
93
+ source_folder : src/releases/
94
+ destination_folder : /cipp-api/
95
+ delete_if_exists : true
0 commit comments