Skip to content

Commit

Permalink
Massive refactor (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverMKing authored Feb 2, 2022
1 parent 5cbd4ac commit ca8d260
Show file tree
Hide file tree
Showing 139 changed files with 19,163 additions and 16,992 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Azure/aks-atlanta
20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/blue-green-bug-bash.md

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "Create release PR"

on:
workflow_dispatch:
inputs:
release:
description: "Define release version (ex: v1, v2, v3)"
required: true

jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if remote branch exists
env:
BRANCH: releases/${{ github.event.inputs.release }}
run: |
echo "##[set-output name=exists;]$(echo $(if [[ -z $(git ls-remote --heads origin ${BRANCH}) ]]; then echo false; else echo true; fi;))"
id: extract-branch-status
# these two only need to occur if the branch exists
- name: Checkout proper branch
if: ${{ steps.extract-branch-status.outputs.exists == 'true' }}
env:
BRANCH: releases/${{ github.event.inputs.release }}
run: git checkout ${BRANCH}
- name: Reset promotion branch
if: ${{ steps.extract-branch-status.outputs.exists == 'true' }}
run: |
git fetch origin main:main
git reset --hard main
- name: Install packages
run: |
rm -rf node_modules/
npm install --no-bin-links
npm run build
- name: Remove node_modules from gitignore
run: |
sed -i '/node_modules/d' ./.gitignore
- name: Create branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: releases/${{ github.event.inputs.release }}
- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Add node modules and new code for release
title: ${{ github.event.inputs.release }} new release
base: releases/${{ github.event.inputs.release }}
branch: create-release
delete-branch: true
14 changes: 13 additions & 1 deletion .github/workflows/run-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
name: Minikube Integration Tests
on: pull_request
on:
pull_request:
branches:
- master
- main
- "releases/*"
push:
branches:
- master
- main
- "releases/*"
workflow_dispatch:

jobs:
run-integration-test:
Expand All @@ -12,6 +23,7 @@ jobs:

- name: Building latest changes
run: |
rm -rf node_modules/
npm install
npm run build
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: "Tag and create release draft"

on:
push:
branches:
- releases/*

jobs:
gh_tagged_release:
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Test release
run: |
sudo npm install n
sudo n latest
npm test
- name: Get branch ending
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/} | sed 's:.*/::')"
id: extract-branch
- name: Get tags
run: |
echo "##[set-output name=tags;]$(echo $(git tag))"
id: extract-tags
- name: Get latest tag
uses: actions/github-script@v5
env:
TAGS: ${{ steps.extract-tags.outputs.tags }}
BRANCH: ${{ steps.extract-branch.outputs.branch }}
with:
script: |
const tags = process.env["TAGS"]
.split(" ")
.map((x) => x.trim());
const branch = process.env["BRANCH"];
const splitTag = (x) =>
x
.substring(branch.length + 1)
.split(".")
.map((x) => Number(x));
function compareTags(nums1, nums2, position = 0) {
if (nums1.length < position && nums2.length < position) return nums2;
const num1 = splitTag(nums1)[position] || 0;
const num2 = splitTag(nums2)[position] || 0;
if (num1 === num2) return compareTags(nums1, nums2, position + 1);
else if (num1 > num2) return nums1;
else return nums2;
}
const branchTags = tags.filter((tag) => tag.startsWith(branch));
if (branchTags.length < 1) return branch + ".-1"
return branchTags.reduce((prev, curr) => compareTags(prev, curr));
result-encoding: string
id: get-latest-tag
- name: Get new tag
uses: actions/github-script@v5
env:
PREV: ${{ steps.get-latest-tag.outputs.result }}
with:
script: |
let version = process.env["PREV"]
if (!version.includes(".")) version += ".0"; // case of v1 or v2
const prefix = /^([a-zA-Z]+)/.exec(version)[0];
const numbers = version.substring(prefix.length);
let split = numbers.split(".");
split[split.length - 1] = parseInt(split[split.length - 1]) + 1;
return prefix + split.join(".");
result-encoding: string
id: get-new-tag
- uses: "marvinpinto/[email protected]"
with:
title: ${{ steps.get-new-tag.outputs.result }} release
automatic_release_tag: ${{ steps.get-new-tag.outputs.result }}
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: true
12 changes: 6 additions & 6 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ on: # rebuild any PRs and main branch changes
pull_request:
branches:
- master
- 'releases/*'
- "releases/*"
push:
branches:
- master
- 'releases/*'
- "releases/*"

jobs:
build: # make sure build/ci works properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: |
npm install
npm test
- uses: actions/checkout@v1
- run: |
npm install
npm test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules

.DS_Store
.DS_Store
.idea
Loading

0 comments on commit ca8d260

Please sign in to comment.