Skip to content

Commit

Permalink
Fixed further automations (#268)
Browse files Browse the repository at this point in the history
* Fixed further automations

- Added a new script to add the correct changelog to the beta versions
- Added an option to keep old beta versions if needed
- Added a default version to the beta pipeline

* further fixes to the beta deployment
  • Loading branch information
cjlapao authored Jan 9, 2025
1 parent e5d75f6 commit 37359be
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 8 deletions.
67 changes: 67 additions & 0 deletions .github/workflow_scripts/get-latest-beta-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

CHANGELOG_FILE="CHANGELOG.md"
OUTPUT_FILE="release_notes.md"
OUTPUT_TO_FILE="FALSE"
REPO=""

while [[ $# -gt 0 ]]; do
case $1 in
-m)
MODE=$2
shift
shift
;;
--version)
VERSION=$2
shift
shift
;;
-v)
VERSION=$2
shift
shift
;;
--CHANGELOG_FILE)
CHANGELOG_FILE=$2
shift
shift
;;
--repo)
REPO=$2
shift
shift
;;
--file)
OUTPUT_FILE shift
shift
;;
--output-to-file)
OUTPUT_TO_FILE="TRUE"
shift
;;
*)
echo "Invalid argument: $1" >&2
exit 1
;;
esac
done

function generate_release_notes() {
# Get the content for the highest version
content=$(./.github/workflow_scripts/generate-changelog.sh --repo "$REPO" --mode RELEASE)

# Write the content to the output file
if [ "$OUTPUT_TO_FILE" == "TRUE" ]; then
echo -e "# Release Notes for v$VERSION\n\n$content" >$OUTPUT_FILE
else
echo -e "# Release Notes for v$VERSION\n\n$content"
fi
}

if [ -z "$REPO" ]; then
echo "Error: --repo is not set" >&2
exit 1
fi

generate_release_notes
4 changes: 2 additions & 2 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Assign Security Label
if: ${{ contains(github.event.issue.title, 'security')}}
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }}
run: |
gh issue edit ${{ github.event.issue.number }} --add-label "security"
assign-security-pr:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Assign Security Label
if: ${{ github.event.pull_request.draft == false && contains(github.event.pull_request.title, 'security')}}
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }}
run: |
gh pr edit ${{ github.event.number }} --add-label "security"
assign-triage-pr:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
core.exportVariable('UPLOAD_URL', release.data.upload_url);
releases-matrix:
needs: release
name: Release Go Binary
name: Release Go Binary (Linux/Windows)
runs-on: ubuntu-latest
env:
EXT_VERSION: ${{ needs.release.outputs.version }}
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
needs:
- release
runs-on: macos-latest
name: Release Go Binary
name: Release Go Binary (macOS)
env:
EXT_VERSION: ${{ needs.release.outputs.version }}
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/publish_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ on:
version:
description: "Version to release"
required: true

default: "1.0.0"
remove_old_beta:
description: "Remove old beta releases"
required: false
type: boolean
default: true
jobs:
check-version-change:
outputs:
Expand Down Expand Up @@ -93,8 +98,10 @@ jobs:
echo "EXT_VERSION=${NEW_VERSION}" >> "$GITHUB_ENV"
echo "MAJOR_VERSION=${MAJOR_VERSION}" >> "$GITHUB_ENV"
- name: Generate release notes
env:
GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }}
run: |
./.github/workflow_scripts/get-latest-changelog.sh --output-to-file
./.github/workflow_scripts/get-latest-beta-changelog.sh --repo ${{ github.repository }} --output-to-file --version "${EXT_VERSION}"
cat release_notes.md
- name: Create release and upload release asset
uses: actions/github-script@v7
Expand All @@ -116,7 +123,7 @@ jobs:
needs:
- check-version-change
- beta-release
name: Release Go Binary
name: Release Go Binary (Windows, Linux)
runs-on: ubuntu-latest
env:
EXT_VERSION: ${{ needs.beta-release.outputs.version }}
Expand Down Expand Up @@ -163,7 +170,7 @@ jobs:
- check-version-change
- beta-release
runs-on: macos-latest
name: Release Go Binary
name: Release Go Binary (macOS)
env:
EXT_VERSION: ${{ needs.beta-release.outputs.version }}
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
Expand Down Expand Up @@ -296,6 +303,7 @@ jobs:
${{ secrets.DOCKER_USERNAME }}/prl-devops-service:latest-beta
${{ secrets.DOCKER_USERNAME }}/prl-devops-service:${{ env.EXT_VERSION }}-beta
remove-old-beta-release:
if: ${{ github.event.inputs.remove_old_beta == true }}
name: Remove old beta release
needs:
- check-version-change
Expand Down

0 comments on commit 37359be

Please sign in to comment.