Skip to content

Commit 5ea63c3

Browse files
Cjlapao/fix some small bugs (#94)
* Add the ability to create beta versions - Added the ability to deploy beta versions for terraform * Release extension version 0.5.13 * updated goreleaser format * Release extension version 0.5.14 * Update VERSION * Update CHANGELOG.md * Improve pipeline announcements (#3) * Improve pipeline announcements - Updated the discord announcement script - Added a script to get the beta changelog - Updated the way we generate release notes to match the type of release * update create release to change the versions for beta and normal * further fixes to the version numbers * further updates to the build pipeline * minor updates to the release process * further fixes to the pipeline * Release extension version 0.6.12926508568 (#5) * fixed the issue with the missing repo for discord * Bump golang.org/x/crypto from 0.32.0 to 0.33.0 (#6) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.32.0 to 0.33.0. - [Commits](golang/crypto@v0.32.0...v0.33.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fixing some small bugs - fixed an issue where installation would fail if packer was not present --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 34c3a45 commit 5ea63c3

File tree

7 files changed

+153
-35
lines changed

7 files changed

+153
-35
lines changed

.github/workflow_scripts/announce_discord.sh

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
WEBHOOK_URL=""
33
VERSION=""
44
BETA="FALSE"
5+
CANARY="FALSE"
6+
REPO=""
57
while [[ $# -gt 0 ]]; do
68
case $1 in
79
--webhook-url)
@@ -18,6 +20,15 @@ while [[ $# -gt 0 ]]; do
1820
BETA="TRUE"
1921
shift
2022
;;
23+
--canary)
24+
CANARY="TRUE"
25+
shift
26+
;;
27+
--repo)
28+
REPO=$2
29+
shift
30+
shift
31+
;;
2132
*)
2233
echo "Invalid argument: $1" >&2
2334
exit 1
@@ -38,7 +49,23 @@ fi
3849

3950
# Get the latest changelog content
4051
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
41-
CHANGELOG_CONTENT=$("$SCRIPT_DIR/get-latest-changelog.sh")
52+
if [ "$BETA" = "TRUE" ]; then
53+
CHANGELOG_CONTENT=$("$SCRIPT_DIR/get-latest-beta-changelog.sh" "--repo" "$REPO" "--version" "$VERSION")
54+
elif [ "$CANARY" = "TRUE" ]; then
55+
CHANGELOG_CONTENT=$("$SCRIPT_DIR/get-latest-beta-changelog.sh" "--repo" "$REPO" "--version" "$VERSION")
56+
else
57+
CHANGELOG_CONTENT=$("$SCRIPT_DIR/get-latest-changelog.sh")
58+
fi
59+
60+
if [ $? -ne 0 ]; then
61+
echo "Failed to get changelog content"
62+
exit 1
63+
fi
64+
65+
if [ -z "$CHANGELOG_CONTENT" ]; then
66+
echo "No changelog content found"
67+
exit 1
68+
fi
4269

4370
# Escape special characters for JSON
4471
CHANGELOG_CONTENT=$(echo "$CHANGELOG_CONTENT" | jq -Rs .)
@@ -51,9 +78,19 @@ if [ ${#CHANGELOG_CONTENT} -gt 4096 ]; then
5178
CHANGELOG_CONTENT+=$"\nFor the complete changelog, visit: https://github.com/Parallels/terraform-provider-parallels-desktop/releases/tag/v${VERSION}"
5279
fi
5380

54-
TITLE="📢 New Release v${VERSION}"
81+
if [[ ! $VERSION == v* ]]; then
82+
VERSION="v${VERSION}"
83+
fi
84+
85+
TITLE="📢 New Release ${VERSION}"
86+
COLOR="5763719"
5587
if [ "$BETA" = "TRUE" ]; then
56-
TITLE="🧪 New Beta Release v${VERSION}"
88+
TITLE="🧪 New Beta Release ${VERSION}"
89+
COLOR="3447003"
90+
fi
91+
if [ "$CANARY" = "TRUE" ]; then
92+
TITLE="🐤 New Canary Release ${VERSION}"
93+
COLOR="16776960"
5794
fi
5895

5996
# Create the JSON payload
@@ -63,7 +100,7 @@ JSON_PAYLOAD=$(
63100
"embeds": [{
64101
"title": "${TITLE}",
65102
"description": "${CHANGELOG_CONTENT}",
66-
"color": 3447003
103+
"color": ${COLOR}
67104
}]
68105
}
69106
EOF
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
CHANGELOG_FILE="CHANGELOG.md"
4+
OUTPUT_FILE="release_notes.md"
5+
OUTPUT_TO_FILE="FALSE"
6+
REPO=""
7+
8+
while [[ $# -gt 0 ]]; do
9+
case $1 in
10+
-m)
11+
MODE=$2
12+
shift
13+
shift
14+
;;
15+
--version)
16+
VERSION=$2
17+
shift
18+
shift
19+
;;
20+
-v)
21+
VERSION=$2
22+
shift
23+
shift
24+
;;
25+
--CHANGELOG_FILE)
26+
CHANGELOG_FILE=$2
27+
shift
28+
shift
29+
;;
30+
--repo)
31+
REPO=$2
32+
shift
33+
shift
34+
;;
35+
--file)
36+
OUTPUT_FILE shift
37+
shift
38+
;;
39+
--output-to-file)
40+
OUTPUT_TO_FILE="TRUE"
41+
shift
42+
;;
43+
*)
44+
echo "Invalid argument: $1" >&2
45+
exit 1
46+
;;
47+
esac
48+
done
49+
50+
function generate_release_notes() {
51+
# Get the content for the highest version
52+
content=$(./.github/workflow_scripts/generate-changelog.sh --repo "$REPO" --mode RELEASE)
53+
54+
# Write the content to the output file
55+
if [ "$OUTPUT_TO_FILE" == "TRUE" ]; then
56+
echo -e "# Release Notes for v$VERSION\n\n$content" >$OUTPUT_FILE
57+
else
58+
echo -e "# Release Notes for v$VERSION\n\n$content"
59+
fi
60+
}
61+
62+
if [ -z "$REPO" ]; then
63+
echo "Error: --repo is not set" >&2
64+
exit 1
65+
fi
66+
67+
generate_release_notes

.github/workflows/create_release_pr.yml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,53 +22,67 @@ jobs:
2222
contents: write
2323
pull-requests: write
2424
env:
25-
new_version: ''
25+
VERSION: ''
2626
steps:
2727
- uses: actions/checkout@v4
2828
- name: Setup Go
2929
uses: actions/setup-go@v4
3030
with:
3131
go-version: '1.22.x'
3232
cache-dependency-path: ${{ github.workspace }}/src/go.sum
33-
- name: Check for Changes to the Changelog
34-
id: diff
35-
if: false
33+
- name: Set new beta version
34+
if: ${{ vars.RELEASE_NAME == 'parallels-desktop-beta' }}
35+
run: |
36+
UPDATED_VERSION=$(./.github/workflow_scripts/increment-version.sh -t ${{ inputs.version }} -f VERSION)
37+
MAJOR_VERSION=${UPDATED_VERSION%.*}
38+
NEW_VERSION=${UPDATED_VERSION%.*}.${{ github.run_id }}
39+
echo "VERSION=${NEW_VERSION}" >> "$GITHUB_ENV"
40+
echo "MAJOR_VERSION=${MAJOR_VERSION}" >> "$GITHUB_ENV"
41+
- name: Set new version
42+
if: ${{ vars.RELEASE_NAME == 'parallels-desktop' }}
3643
run: |
3744
NEW_VERSION=$(./.github/workflow_scripts/increment-version.sh -t ${{ inputs.version }} -f VERSION)
38-
LAST_CHANGELOG_VERSION=$(./.github/workflow_scripts/get-latest-changelog-version.sh)
39-
if [ "$NEW_VERSION" != "$LAST_CHANGELOG_VERSION" ]; then
40-
echo "Changelog not updated for version $NEW_VERSION latest version is $LAST_CHANGELOG_VERSION"
41-
exit 1
42-
fi
45+
echo "VERSION=${NEW_VERSION}" >> "$GITHUB_ENV"
4346
- name: Bump version and push
4447
env:
4548
GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }}
49+
VERSION: ${{ env.VERSION }}
4650
run: |
4751
git config --global user.email "cjlapao@gmail.com"
4852
git config --global user.name "cjlapao"
4953
50-
NEW_VERSION=$(./.github/workflow_scripts/increment-version.sh -t ${{ inputs.version }} -f VERSION)
51-
echo "$NEW_VERSION" > ./VERSION
54+
echo "$VERSION" > ./VERSION
5255
53-
git checkout -b release/"$NEW_VERSION"
56+
git checkout -b release/"$VERSION"
5457
5558
# Generate changelog for the new version
56-
./.github/workflow_scripts/generate-changelog.sh --repo ${{ github.repository }} --version $NEW_VERSION
59+
./.github/workflow_scripts/generate-changelog.sh --repo ${{ github.repository }} --version $VERSION
5760
5861
git add VERSION CHANGELOG.md
59-
git commit -m "Release extension version $NEW_VERSION"
60-
61-
git push --set-upstream origin release/$NEW_VERSION
62+
git commit -m "Release extension version $VERSION"
6263
63-
echo "new_version=$NEW_VERSION" >> "$GITHUB_ENV"
64+
git push --set-upstream origin release/$VERSION
65+
- name: Generate beta release notes
66+
if: ${{ vars.RELEASE_NAME == 'parallels-desktop-beta' }}
67+
run: |
68+
./.github/workflow_scripts/get-latest-beta-changelog.sh --repo ${{ github.repository }} --output-to-file --version "${{ env.VERSION }}"
69+
cat release_notes.md
70+
env:
71+
GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }}
72+
- name: Generate release notes
73+
if: ${{ vars.RELEASE_NAME == 'parallels-desktop' }}
74+
run: |
75+
./.github/workflow_scripts/get-latest-changelog.sh --output-to-file
76+
cat release_notes.md
77+
env:
78+
GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }}
6479
- name: Create PR
6580
run: |
66-
./.github/workflow_scripts/generate-changelog.sh --mode RELEASE --repo ${{ github.repository }} --version ${{ env.new_version }} --output-to-file
6781
gh pr create \
68-
--title "Release version ${{ env.new_version }}" \
82+
--title "Release version ${{ env.VERSION }}" \
6983
--body-file release_notes.md \
7084
--base main \
71-
--head release/${{ env.new_version }}
85+
--head release/${{ env.VERSION }}
7286
gh pr edit --add-label release-request
7387
env:
7488
GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }}

.github/workflows/release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ jobs:
5151
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
5252
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
5353
RELEASE_NAME: ${{ vars.RELEASE_NAME }}
54-
5554
verify-publications:
5655
needs: terraform-provider-release
5756
runs-on: ubuntu-latest
@@ -139,13 +138,13 @@ jobs:
139138
id: announce_discord_beta
140139
if: ${{ vars.RELEASE_NAME == 'parallels-desktop-beta' }}
141140
run: |
142-
./.github/workflow_scripts/announce_discord.sh --webhook-url $DISCORD_WEBHOOK --version $VERSION --beta
141+
./.github/workflow_scripts/announce_discord.sh --repo ${{ github.repository }} --webhook-url $DISCORD_WEBHOOK --version $VERSION --beta
143142
env:
144143
SLACK_WEBHOOKS: ${{ env.DISCORD_WEBHOOK }}
145144
- name: Announce on discord stable
146145
id: announce_discord
147146
if: ${{ vars.RELEASE_NAME == 'parallels-desktop' }}
148147
run: |
149-
./.github/workflow_scripts/announce_discord.sh --webhook-url $DISCORD_WEBHOOK --version $VERSION
148+
./.github/workflow_scripts/announce_discord.sh --repo ${{ github.repository }} --webhook-url $DISCORD_WEBHOOK --version $VERSION
150149
env:
151150
SLACK_WEBHOOKS: ${{ env.DISCORD_WEBHOOK }}

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
All notable changes to this project will be documented in this file.
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6-
## [0.5.13] - 2025-01-22
6+
## [0.6.12926508568] - 2025-01-23
77

8+
- Updated the discord announcement script
9+
- Added a script to get the beta changelog
10+
- Updated the way we generate release notes to match the type of release
11+
12+
## [0.5.13] - 2025-01-22
13+
814
- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
9-
- fixes # (issue)
1015
- Fixed an issue with the installation of brew in both mac intel and arm variants
1116
- Added a new provider for the beta versions
12-
17+
1318
## [0.5.12] - 2025-01-21
1419

1520
- fixed an issue where brew would give an error when trying to install PD into an intel mac

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.13
1+
0.6.12926508568

internal/deploy/resource.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,31 +453,27 @@ func (r *DeployResource) Update(ctx context.Context, req resource.UpdateRequest,
453453
// getting parallels version
454454
if version, err := parallelsClient.GetVersion(ctx); err != nil {
455455
data.CurrentVagrantVersion = types.StringValue("-")
456-
return
457456
} else {
458457
data.CurrentVersion = types.StringValue(version)
459458
}
460459

461460
// getting git version
462461
if version, err := parallelsClient.GetGitVersion(ctx); err != nil {
463462
data.CurrentVagrantVersion = types.StringValue("-")
464-
return
465463
} else {
466464
data.CurrentGitVersion = types.StringValue(version)
467465
}
468466

469467
// getting packer version
470468
if version, err := parallelsClient.GetPackerVersion(ctx); err != nil {
471469
data.CurrentVagrantVersion = types.StringValue("-")
472-
return
473470
} else {
474471
data.CurrentPackerVersion = types.StringValue(version)
475472
}
476473

477474
// getting Vagrant version
478475
if version, err := parallelsClient.GetVagrantVersion(ctx); err != nil {
479476
data.CurrentVagrantVersion = types.StringValue("-")
480-
return
481477
} else {
482478
data.CurrentVagrantVersion = types.StringValue(version)
483479
}

0 commit comments

Comments
 (0)