Skip to content

Commit

Permalink
rename & cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarrku committed Nov 4, 2021
1 parent 3d8979d commit 11a8173
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 1,379 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/autoreleaser.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/release-branch-tagger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release Branch Tagger
on:
workflow_dispatch:
push:
branches:
- 'release/**'

jobs:
release-branch-tagger:
name: Tag & Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Action needs all info about tags so pass fetch-depth: 0
fetch-depth: 0

- name: Tag & Release
uses: ./release-branch-tagger # Uses an action in the root directory
env:
# Use SKEDIBOT_PAT so it can trigger deploy actions from running.
GITHUB_TOKEN: ${{ secrets.SKEDIBOT_PAT }}
with:
applications: '[{"name":"web-admin"}, {"name":"web-video"}]'
is-stable-release: ${{ github.event_name == 'workflow_dispatch' }}

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Create Release
name: Release Creator
on:
workflow_dispatch:
inputs:
release-tag:
release-name:
description: 'Release tag'
required: true
finalize:
description: 'Finalize (Y/N)'
finalize-release:
description: 'Finalize release (Y/N)'
required: false
default: 'N'

Expand All @@ -18,10 +18,10 @@ jobs:
# you must check out the repository
- name: Checkout
uses: actions/checkout@v2
- name: Hello world action step
uses: ./create-release # Uses an action in the root directory
id: my-release-action
with:
- name: Create releases on repo's
uses: ./release-creator # Uses an action in the root directory
env:
GITHUB_TOKEN: ${{ secrets.SKEDIBOT_PAT }}
RELEASE_VERSION: ${{ github.event.inputs.release-tag }}
FINALISE_RELEASE: ${{ github.event.inputs.finalize }}
with:
release-name: ${{ github.event.inputs.release-name }}
finalize-release: ${{ github.event.inputs.finalize-release }}
10 changes: 0 additions & 10 deletions __tests__/main.test.ts

This file was deleted.

8 changes: 0 additions & 8 deletions autorelease/dist/index.js

This file was deleted.

1 change: 0 additions & 1 deletion autorelease/dist/index.js.map

This file was deleted.

646 changes: 0 additions & 646 deletions autorelease/dist/licenses.txt

This file was deleted.

1 change: 0 additions & 1 deletion autorelease/dist/sourcemap-register.js

This file was deleted.

8 changes: 0 additions & 8 deletions create-release/dist/index.js

This file was deleted.

1 change: 0 additions & 1 deletion create-release/dist/index.js.map

This file was deleted.

622 changes: 0 additions & 622 deletions create-release/dist/licenses.txt

This file was deleted.

1 change: 0 additions & 1 deletion create-release/dist/sourcemap-register.js

This file was deleted.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "typescript-action",
"name": "skedify-workflow-mono",
"version": "0.0.0",
"private": true,
"description": "TypeScript template action",
"description": "Repository that contains reusable workflows for Skedify",
"scripts": {
"build": "tsc",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
"package": "npm run package:create-release && npm run package:autorelease",
"package:autorelease": "ncc build lib/autoreleaser/main.js -o autorelease/dist --source-map --license licenses.txt -m ",
"package:create-release": "ncc build lib/create-release/main.js -o create-release/dist --source-map --license licenses.txt -m ",
"test": "jest",
"package": "npm run package:release-creator && npm run package:release-branch-tagger",
"package:release-branch-tagger": "ncc build lib/release-branch-tagger/main.js -o release-branch-tagger/dist --source-map --license licenses.txt -m ",
"package:release-creator": "ncc build lib/release-creator/main.js -o release-creator/dist --source-map --license licenses.txt -m ",
"test": "jest --passWithNoTests",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions/typescript-action.git"
"url": "git+https://github.com/skedify/github-workflows.git"
},
"keywords": [
"actions",
Expand Down
4 changes: 2 additions & 2 deletions release-branch-tagger/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release-branch-tagger/dist/index.js.map

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions release-creator/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: 'Hello World'
description: 'Greet someone and record the time'
name: 'Release Creator'
description: 'Will loop over Skedify repos & create release branches/trigger stable release'
inputs:
GITHUB_TOKEN: # id of input
description: 'GitHub Auth token'
required: true
RELEASE_VERSION: # id of input
release-name: # id of input
description: 'Release version'
required: true
FINALISE_RELEASE: # id of input
description: 'Y/N to create release tags'
finalize-release: # id of input
description: 'Y/N to create stable release tags'
required: true
# default: 'World'
default: 'N'
runs:
using: 'node12'
main: './dist/index.js'
4 changes: 2 additions & 2 deletions release-creator/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release-creator/dist/index.js.map

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions src/create-release/main.ts → src/release-creator/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ const WORKFLOW_NAME = 'release-branch-tagger.yml'
return
}

const releaseVersion = core.getInput('RELEASE_VERSION')
const finalizeReleaseInput = getOptionalInput('FINALISE_RELEASE') || 'N'
const releaseName = core.getInput('release-name')
const finalizeReleaseInput = getOptionalInput('finalize-release') || 'N'
const finalizeRelease = finalizeReleaseInput === 'Y'

const octokit = github.getOctokit(GITHUB_TOKEN)

const finalizeRelease = finalizeReleaseInput === 'Y'

const taskResults = await Promise.allSettled(
repos.map(async ({repo, mainBranchName}) => {
const log = createLogger(repo)
const octokitInstance = createOctokitInstance({octokit, repo})

const releaseBranchName = `release/${releaseVersion}`
const releaseBranchName = `release/${releaseName}`

try {
try {
Expand All @@ -43,7 +42,7 @@ const WORKFLOW_NAME = 'release-branch-tagger.yml'
log('Release branch not found!')
if (finalizeRelease)
throw new Error(
`Trying to finalize ${releaseVersion} while the release branch doesn't exist, aborting...`
`Trying to finalize ${releaseName} while the release branch doesn't exist, aborting...`
)

log(`Getting main branch: ${mainBranchName}`)
Expand Down
1 change: 0 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export function createOctokitInstance({octokit, repo}: {octokit: OctokitInstance
}
}


export function getPrefixedThrow(prefix: string) {
return function throwError(message: string): never {
throw new Error(`${prefix}: ${message}`)
Expand Down

0 comments on commit 11a8173

Please sign in to comment.