Skip to content

Commit 5478f90

Browse files
committed
Add the ability to create beta versions
- Added the ability to deploy beta versions for terraform
1 parent b0e4ef1 commit 5478f90

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

.github/workflow_scripts/announce_discord.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
WEBHOOK_URL=""
33
VERSION=""
4+
BETA="FALSE"
45
while [[ $# -gt 0 ]]; do
56
case $1 in
67
--webhook-url)
@@ -13,6 +14,10 @@ while [[ $# -gt 0 ]]; do
1314
shift
1415
shift
1516
;;
17+
--beta)
18+
BETA="TRUE"
19+
shift
20+
;;
1621
*)
1722
echo "Invalid argument: $1" >&2
1823
exit 1
@@ -46,12 +51,17 @@ if [ ${#CHANGELOG_CONTENT} -gt 4096 ]; then
4651
CHANGELOG_CONTENT+=$"\nFor the complete changelog, visit: https://github.com/Parallels/terraform-provider-parallels-desktop/releases/tag/v${VERSION}"
4752
fi
4853

54+
TITLE="📢 New Release v${VERSION}"
55+
if [ "$BETA" = "TRUE" ]; then
56+
TITLE="🧪 New Beta Release v${VERSION}"
57+
fi
58+
4959
# Create the JSON payload
5060
JSON_PAYLOAD=$(
5161
cat <<EOF
5262
{
5363
"embeds": [{
54-
"title": "📢 New Release v${VERSION}",
64+
"title": "${TITLE}",
5565
"description": "${CHANGELOG_CONTENT}",
5666
"color": 3447003
5767
}]
@@ -68,6 +78,6 @@ curl -H "Content-Type: application/json" \
6878
if [ $? -eq 0 ]; then
6979
echo "Successfully posted changelog to Discord"
7080
else
71-
echo "Failed to post changelog to Discord"
81+
echo "Failed to post changelog to Discord webhook"
7282
exit 1
7383
fi

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5151
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
5252
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
53+
RELEASE_NAME: ${{ vars.RELEASE_NAME }}
5354

5455
verify-publications:
5556
needs: terraform-provider-release
@@ -72,7 +73,7 @@ jobs:
7273
if (targetVersion.startsWith('v')) {
7374
targetVersion = targetVersion.substring(1);
7475
}
75-
const url = `${registry}/providers/Parallels/parallels-desktop/versions`;
76+
const url = `${registry}/providers/Parallels/${{ vars.RELEASE_NAME }}/versions`;
7677
7778
const response = await fetch(url);
7879
if (!response.ok) {
@@ -134,8 +135,16 @@ jobs:
134135
run: |
135136
VERSION=$(cat VERSION)
136137
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
137-
- name: Announce on discord
138+
- name: Announce on discord beta
139+
id: announce_discord_beta
140+
if: ${{ vars.RELEASE_NAME == 'parallels-desktop-beta' }}
141+
run: |
142+
./.github/workflow_scripts/announce_discord.sh --webhook-url $DISCORD_WEBHOOK --version $VERSION --beta
143+
env:
144+
SLACK_WEBHOOKS: ${{ env.DISCORD_WEBHOOK }}
145+
- name: Announce on discord stable
138146
id: announce_discord
147+
if: ${{ vars.RELEASE_NAME == 'parallels-desktop' }}
139148
run: |
140149
./.github/workflow_scripts/announce_discord.sh --webhook-url $DISCORD_WEBHOOK --version $VERSION
141150
env:

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ builds:
1515
flags:
1616
- -trimpath
1717
ldflags:
18-
- "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X 'terraform-provider-parallels-desktop/internal/telemetry.AMPLITUDE_API_KEY={{ .Env.AMPLITUDE_API_KEY }}'"
18+
- "-s -w -X main.version={{.Version}} -X main.release_name={{.Env.RELEASE_NAME}} -X main.commit={{.Commit}} -X 'terraform-provider-parallels-desktop/internal/telemetry.AMPLITUDE_API_KEY={{ .Env.AMPLITUDE_API_KEY }}'"
1919
goos:
2020
- freebsd
2121
- windows

main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ import (
2727

2828
// these will be set by the goreleaser configuration
2929
// to appropriate values for the compiled binary.
30-
var version string = "dev"
30+
var (
31+
version string = "dev"
32+
release_name string = "parallels-desktop"
33+
)
3134

3235
// goreleaser can pass other information to the main package, such as the specific commit
3336
// https://goreleaser.com/cookbooks/using-main.version/
@@ -45,7 +48,7 @@ func main() {
4548
// provider address is used in these tutorials in conjunction with a
4649
// specific Terraform CLI configuration for manual development testing
4750
// of this provider.
48-
Address: "registry.terraform.io/parallels/parallels-desktop",
51+
Address: "registry.terraform.io/parallels/" + release_name,
4952
Debug: debug,
5053
}
5154

0 commit comments

Comments
 (0)