From 8b128bba23d228cc13c8cf89d70f47f464591817 Mon Sep 17 00:00:00 2001 From: nikiwycherley Date: Mon, 20 May 2024 13:07:39 +0100 Subject: [PATCH] Revert "Release 8.3.0 (#697)" This reverts commit abcbc51653d2177eca836a74e7b6c1039d6e5f9a. --- .github/workflows/merge.yml | 33 +++++++-------------------------- .github/workflows/release.yml | 18 +++++++----------- package-lock.json | 4 ++-- package.json | 2 +- release-docs/CFF-8.3.0.md | 30 ------------------------------ release-docs/template.njk | 7 +++---- test/scripts.js | 27 --------------------------- 7 files changed, 20 insertions(+), 101 deletions(-) delete mode 100644 release-docs/CFF-8.3.0.md delete mode 100644 test/scripts.js diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 73fbfc822..af2bf9e1f 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -34,6 +34,9 @@ jobs: with: node-version: '18' + - name: Install dependencies + run: npm install + - name: Setup version env vars run: | version=${{ github.event.inputs.version }} @@ -49,36 +52,14 @@ jobs: exit 1 fi - - name: Check PR's approved - run: | - function prCheck () { - REPO=$1 - BASE=$2 - STATE=$(gh pr list --repo $GITHUB_REPOSITORY_OWNER/$REPO --json title,mergeStateStatus,state,reviews --state OPEN --base $BASE --head $RELEASE_BRANCH --jq '.[] | select(.mergeStateStatus == "CLEAN" and .reviews[].state == "APPROVED") | .reviews[].state ') - if [ "$STATE" != "APPROVED" ]; then - echo "Error: PR for merging $GITHUB_REPOSITORY_OWNER/$REPO $RELEASE_BRANCH into $BASE needs to be ready to merge and approved. (STATE=$STATE)" >&2 - exit 1 - fi - } - prCheck flood-app master - prCheck flood-app development - prCheck flood-service master - prCheck flood-service development - env: - # create classic PAT and then run `gh secret set GH_WORKFLOW` - GH_TOKEN: ${{ secrets.GH_WORKFLOW }} - - - name: Install dependencies - run: npm install - - name: Merge release branch into master run: | git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" git switch $RELEASE_BRANCH git switch master - git merge --no-edit $RELEASE_BRANCH - git push origin master + git merge --ff-only $RELEASE_BRANCH + git push - name: Create GitHub Release run: gh release create $TAG_VERSION --title "Release $VERSION" --notes "[release notes](/$RELEASE_NOTES_FILE)" @@ -89,8 +70,8 @@ jobs: - name: Merge release branch into development run: | git switch development - git merge --no-edit $RELEASE_BRANCH - git push origin development + git merge --ff-only $RELEASE_BRANCH + git push - name: Trigger Merge Release Branch for flood-service run: gh workflow run --repo "$GITHUB_REPOSITORY_OWNER/flood-service" merge.yml -f version="$VERSION" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d6cddb59..e7d3b0402 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,6 +32,11 @@ jobs: - name: Display inputs run: echo "${{ github.event.inputs.jira_release_id }} ${{ github.event.inputs.increment }} ${{ github.event.inputs.db_changes }} ${{ github.event.inputs.proposed_release_date }}" + - name: Validate date + run: | + date=$(date --date "${{ github.event.inputs.proposed_release_date }}" "+%d/%m/%Y") + echo FORMATTED_DATE=$(date --date $date "+%A %d %B %Y") >> "$GITHUB_ENV" + - name: Check PAT token is still valid run: | gh workflow list --repo "$GITHUB_REPOSITORY_OWNER/flood-service" @@ -74,6 +79,7 @@ jobs: git switch -c $RELEASE_BRANCH git add . git commit -m "Bump version number (${VERSION})" + git push origin $RELEASE_BRANCH env: FLOOD_APP_BING_KEY: "${{ secrets.FLOOD_APP_BING_KEY }}" FLOOD_APP_BING_KEY_LOCATION: "${{ secrets.FLOOD_APP_BING_KEY_LOCATION }}" @@ -98,12 +104,10 @@ jobs: --template "release-docs/template.njk" git add $release_notes_file git commit --no-verify -m "Add release notes (${VERSION})" + git push origin $RELEASE_BRANCH echo RELEASE_NOTES_FILE=$release_notes_file >> "$GITHUB_ENV" fi - - name: Push changes - run: git push origin $RELEASE_BRANCH - - name: Create Draft PRs run: | gh pr create --base master --title "Release $VERSION" --body "TBC" @@ -117,11 +121,3 @@ jobs: env: # use PAT token with repo scope (github.token didn't work) GH_TOKEN: ${{ secrets.GH_WORKFLOW }} - - - name: Clean up - if: ${{ failure() }} - run: | - if git ls-remote --exit-code origin "refs/heads/${RELEASE_BRANCH}"; then - echo "Action failed, removing created release branch" - git push --delete origin $RELEASE_BRANCH - fi diff --git a/package-lock.json b/package-lock.json index 51cb2a27c..a9adfbfa6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "flood-app", - "version": "8.3.0", + "version": "8.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "flood-app", - "version": "8.3.0", + "version": "8.2.0", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 1baa06438..11d8772fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flood-app", - "version": "8.3.0", + "version": "8.2.0", "description": "Flood risk app", "main": "index.js", "repository": "github:defra/flood-app", diff --git a/release-docs/CFF-8.3.0.md b/release-docs/CFF-8.3.0.md deleted file mode 100644 index 90d05a2f5..000000000 --- a/release-docs/CFF-8.3.0.md +++ /dev/null @@ -1,30 +0,0 @@ -# Check For Flooding Release - -* Version: 8.3.0 -* Proposed Release Date: 22/05/2024 -* Jira Release Overview: https://eaflood.atlassian.net/projects/FSR/versions/16850/tab/release-report-all-issues - -## Tickets - - * FSR-1193 | TA Update - 22 May 2024 - -## Instructions - -This release is for target area updates - - 1 - Update LFW_{STAGE}_99_LOAD_FLOOD_ALERT_AREAS jenkins job with the following properties update for the updated database name for production: - - DB_NAME=floodprdg - ###### OR ######## - DB_NAME=floodprdb - - 2 - Execute LFW_{STAGE}_99_LOAD_FLOOD_ALERT_AREAS - - 3 - Execute LFW_{STAGE}_04_UPDATE_FLOOD_APP_AND_SERVICE_PIPELINE - - -Execute smoke tests and forward results - -## Related Infrastructure Changes Required - -* None diff --git a/release-docs/template.njk b/release-docs/template.njk index 0293bc2a8..af5bf1ac4 100644 --- a/release-docs/template.njk +++ b/release-docs/template.njk @@ -6,12 +6,11 @@ ## Sense Check -* Note that this is the definitive release notes for WebOps. The release notes in flood-service and flood-db are for CFF dev team use only. * Cross check the list of Jira tickets below with those in the Jira release linked to above and update where needed -* Add additional Jira tickets from the related release notes in the 'Release {{ version }}' PR's created in: - * [flood-service](https://github.com/DEFRA/flood-service) +* Add additional Jira tickets from the related release notes: + * [flood-service](https://github.com/DEFRA/flood-service/blob/release/{{ version }}/release-docs/CFF-{{ version }}.md) {% if dbChanges %} - * [flood-db](https://github.com/DEFRA/flood-db) + * [flood-db](https://github.com/DEFRA/flood-db/blob/release{{ version }}/release-docs/CFF-{{ version }}.md) {% endif %} * Add any required infrastructure changes such as redirects to the infrastructure changes section below * Once this sense check is done, delete this section diff --git a/test/scripts.js b/test/scripts.js deleted file mode 100644 index 2d2768c32..000000000 --- a/test/scripts.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -const Lab = require('@hapi/lab') -const { expect } = require('@hapi/code') -const { describe, it } = exports.lab = Lab.script() - -async function executeNpmScript (scriptName) { - const util = require('util') - const exec = util.promisify(require('child_process').exec) - try { - const { stdout, stderr } = await exec(`npm run ${scriptName}`) - return { stdout, stderr } - } catch (error) { - return { stdout: '', stderr: error.stderr } - } -} -describe('scripts', () => { - it('should run help for create-release-notes successfully', async () => { - // this test is to check that all the necessary modules are installed following the accidental - // removal of nunjucks and yargs which wasn't picked up until the create release github action - // was run - const { stdout, stderr } = await executeNpmScript('create-release-notes -- --help') - - expect(stderr).to.be.empty() - expect(stdout).to.contain('node release-docs/lib/create-release-notes.js --help') - }) -})