Skip to content

Commit

Permalink
ci: add release automation (keptn-sandbox#80)
Browse files Browse the repository at this point in the history
Adds pre-release and release workflow.
Packaged extension is added to both prerelease and release as an asset.
Prerelease workflow will package the dev extension while releases will package the public extension

Signed-off-by: Paolo Chila <[email protected]>
  • Loading branch information
pchila authored Mar 8, 2022
1 parent eec12ed commit 9fad8b3
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 10 deletions.
8 changes: 2 additions & 6 deletions .github/actions/unit-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
name: 'Unit Tests'
description: 'Run unit tests using Node.js'
inputs:
NODE_VERSION:
default: "14"
description: "NodeJS version to be used for the test run"
required: false
KEPTN_API_ENDPOINT:
default: ""
description: "Keptn API endpoint to be used for test run"
Expand All @@ -16,11 +12,11 @@ inputs:
required: true
runs:
using: "composite"
steps:
steps:
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{inputs.NODE_VERSION}}
node-version: 14
- name: Install tsc
shell: bash
run: npm install [email protected]
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defaults:
jobs:
prepare_ci_run:
name: Prepare CI Run
uses: keptn/gh-automation/.github/workflows/prepare-ci.yml@v1.4.0
uses: keptn/gh-automation/.github/workflows/prepare-ci.yml@v1.5.1

############################################################################
# Unit tests #
Expand All @@ -33,4 +33,3 @@ jobs:
with:
KEPTN_API_ENDPOINT: http://somekeptninstall.mock/api
KEPTN_API_TOKEN: somefancysupersecrettoken

33 changes: 33 additions & 0 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Create Pre-Release
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Unit tests
uses: ./.github/actions/unit-tests

pre-release:
needs: test
name: Pre-Release
uses: keptn/gh-automation/.github/workflows/[email protected]

package-dev-extension:
needs: [pre-release]
name: "Package DEV extension"
runs-on: ubuntu-20.04
env:
VERSION: ${{ needs.pre-release.outputs.RELEASE_TAG }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRE_RELEASE_SEPARATOR: "next"
steps:
- name: Check out repository
uses: actions/checkout@v3
- run: |
npm install
# transform x.y.z-next.{prerelease} into x.y.z.{prerelease} for packaging and publishing the extension as per Microsoft requirements
AZDO_EXT_VERSION=$(echo ${VERSION} | sed 's/-${{env.PRE_RELEASE_SEPARATOR}}\(\.[[:digit:]]\+\)$/\1/g') npm run package-dev
gh release upload "${VERSION}" *.vsix
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Create Release
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Unit tests
uses: ./.github/actions/unit-tests

release:
needs: test
name: Release
uses: keptn/gh-automation/.github/workflows/[email protected]

package-dev-extension:
needs: [release]
name: "Package PUBLIC extension"
runs-on: ubuntu-20.04
env:
VERSION: ${{ needs.release.outputs.RELEASE_TAG }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AZDO_EXT_VERSION: ${{ needs.release.outputs.RELEASE_TAG }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- run: |
npm install
npm run package
gh release upload "${VERSION}" *.vsix
2 changes: 1 addition & 1 deletion .github/workflows/validate-semantic-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- synchronize
jobs:
validate:
uses: keptn/gh-automation/.github/workflows/validate-semantic-pr.yml@main
uses: keptn/gh-automation/.github/workflows/validate-semantic-pr.yml@v1.5.1
with:
# Configure which scopes are allowed.
scopes: |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "keptn-integration",
"version": "1.0.0",
"version": "1.5.0",
"description": "Integration of Keptn within your build.",
"scripts": {
"clean": "rimraf ./*.vsix ./dist",
Expand Down

0 comments on commit 9fad8b3

Please sign in to comment.