Skip to content

Commit

Permalink
chore: Use draft release on supported versions (RocketChat#31123)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok authored Nov 30, 2023
1 parent f49f62d commit 47baff5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
35 changes: 34 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,42 @@ jobs:
echo "DOCKER_TAG: ${DOCKER_TAG}"
echo "gh-docker-tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT
notify-draft-services:
name: 🚀 Notify external services - draft
runs-on: ubuntu-20.04
needs: [release-versions]
if: github.event_name == 'release'
steps:
- name: Register release on cloud as Draft
run: |
REPO_VERSION=$(node -p "require('./package.json').version")
if [[ '${{ github.event_name }}' = 'release' ]]; then
GIT_TAG="${GITHUB_REF#*tags/}"
GIT_BRANCH=""
ARTIFACT_NAME="${REPO_VERSION}"
RC_VERSION=$GIT_TAG
if [[ '${{ needs.release-versions.outputs.release }}' = 'release-candidate' ]]; then
RC_RELEASE=candidate
elif [[ '${{ needs.release-versions.outputs.release }}' = 'latest' ]]; then
RC_RELEASE=stable
fi
else
GIT_TAG=""
GIT_BRANCH="${GITHUB_REF#*heads/}"
ARTIFACT_NAME="${REPO_VERSION}.$GITHUB_SHA"
RC_VERSION="${REPO_VERSION}"
RC_RELEASE=develop
fi;
curl -H "Content-Type: application/json" -H "X-Update-Token: $UPDATE_TOKEN" -d \
"{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"compatibleMongoVersions\": [\"4.4\", \"5.0\", \"6.0\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"draft\", \"draftAs\": \"$RC_RELEASE\"}" \
https://releases.rocket.chat/update
packages-build:
name: 📦 Build Packages
needs: [release-versions]
needs: [release-versions, notify-draft-services]
runs-on: ubuntu-20.04
steps:
- name: Github Info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ class VersionCompiler {
async processFilesForTarget(files) {
const processVersionFile = async function (file) {
const data = await new Promise((resolve, reject) => {
const currentVersion =
JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }))?.version || '';

const url = `https://releases.rocket.chat/v2/server/supportedVersions?includeDraftType=stable&includeDraftTag=${currentVersion}`;

https
.get('https://releases.rocket.chat/v2/server/supportedVersions', function (response) {
.get(url, function (response) {
let data = '';
response.on('data', function (chunk) {
data += chunk;
Expand Down

0 comments on commit 47baff5

Please sign in to comment.