-
Notifications
You must be signed in to change notification settings - Fork 2
155 lines (137 loc) · 4.96 KB
/
cd.release.yml
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-[a-z]+'
- 'v[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+'
defaults:
run:
shell: bash
jobs:
Build:
name: Build Release (${{ matrix.os }})
uses: ./.github/workflows/reusable.build.yml
strategy:
fail-fast: true
matrix:
os: [ 'macos-13' , 'windows-2022' ]
with:
os: ${{ matrix.os }}
build_type: Release
upload_artifacts: ${{ true }}
Package:
name: Package Build (${{ matrix.os }})
uses: ./.github/workflows/reusable.package.yml
needs: [ Build ]
strategy:
fail-fast: false
matrix:
include:
- name: macOS
os: macos-13
- name: Windows
os: windows-2022
with:
os: ${{ matrix.os }}
plugin_name: Rotor
plugin_version: 1.0.0
plugin_bundle_id: com.bbx-audio.rotor
secrets: inherit
Release:
runs-on: ubuntu-latest
needs: [ Package ]
permissions:
contents: write
id-token: write
env:
PLUGIN_NAME: Rotor
PLUGIN_VERSION: 1.0.0
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Set Environment Variables
run: |
VERSION=${GITHUB_REF#refs/tags/v}
STAGE_INFO=$(echo "$VERSION" | perl -0777 -pe 's/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([a-z]+)(?:\.([0-9]+))?)?$/\1 \2 \3 \4 \5/')
MAJOR=$(echo "$STAGE_INFO" | awk '{print $1}')
MINOR=$(echo "$STAGE_INFO" | awk '{print $2}')
PATCH=$(echo "$STAGE_INFO" | awk '{print $3}')
STAGE=$(echo "$STAGE_INFO" | awk '{print $4}')
STAGE_VERSION=$(echo "$STAGE_INFO" | awk '{print $5}')
if [ -z "$STAGE" ]; then
RELEASE_NAME="$PLUGIN_NAME v$MAJOR.$MINOR.$PATCH"
STAGE=production
else
if [ -z "$STAGE_VERSION" ]; then
STAGE_VERSION=1
fi
RELEASE_NAME="$PLUGIN_NAME v$MAJOR.$MINOR.$PATCH-$STAGE.$STAGE_VERSION"
fi
echo "VERSION=$MAJOR.$MINOR.$PATCH" >> $GITHUB_ENV
echo "STAGE=$STAGE" >> $GITHUB_ENV
echo "STAGE_VERSION=$STAGE_VERSION" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
echo "WINDOWS_ARTIFACT_NAME=$PLUGIN_NAME-$PLUGIN_VERSION-Windows" >> $GITHUB_ENV
echo "MACOS_ARTIFACT_NAME=$PLUGIN_NAME-$PLUGIN_VERSION-macOS" >> $GITHUB_ENV
- name: Check Tag & Version
run: |
if [[ $PLUGIN_VERSION != *"$VERSION"* ]]; then
echo "The plugin version specified in this workflow and tag-derived version do not match. Exiting."
exit 1
fi
if [[ $STAGE != "production" ]] && [[ $PLUGIN_VERSION != *"$STAGE"* ]]; then
echo "The plugin version stage specified in this workflow and tag-derived version stage do not match. Exiting."
exit 1
fi
- name: Authenticate Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.GOOGLE_CLOUD_PROJECT_ID }}
service_account: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT }}
credentials_json: ${{ secrets.GOOGLE_CLOUD_AUTH_JSON }}
- name: Setup Google Cloud
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GOOGLE_CLOUD_PROJECT_ID }}
- name: Upload to Cloud Storage
run: |
gcloud storage cp "**/*.{dmg,exe}" "gs://${{ secrets.GOOGLE_CLOUD_STORAGE_BUCKET }}/${{ env.STAGE }}"
- name: Prepare Body
run: |
echo "### Overview" >> RELEASE.md
echo "" >> RELEASE.md
if [[ $STAGE == "production" ]]; then
echo "New $PLUGIN_NAME release! 🚀" >> RELEASE.md
else
echo "New $PLUGIN_NAME $STAGE (no. $STAGE_VERSION) release! 🚀" >> RELEASE.md
fi
echo "" >> RELEASE.md
echo "Download the plugin installers below and have fun!" >> RELEASE.md
echo "" >> RELEASE.md
echo "------" >> RELEASE.md
echo "" >> RELEASE.md
echo "### Changelog" >> RELEASE.md
echo "" >> RELEASE.md
echo "**Added**:" >> RELEASE.md
echo "- ..." >> RELEASE.md
echo "" >> RELEASE.md
echo "**Changed**:" >> RELEASE.md
echo "- ..." >> RELEASE.md
echo "" >> RELEASE.md
echo "**Removed**:" >> RELEASE.md
echo "- ..." >> RELEASE.md
echo "" >> RELEASE.md
echo "**Full Changelog**: https://github.com/blackboxaudio/rotor/compare/vX.Y.Z...v$PLUGIN_VERSION" >> RELEASE.md
- name: Draft Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.RELEASE_NAME }}
prerelease: ${{ env.STAGE != 'production' }}
draft: true
body_path: ./RELEASE.md
files: |
**/*.dmg
**/*.exe