From 9fad8b3c835069c2f41eb30aea7f75954c22497c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paolo=20Chil=C3=A0?= Date: Tue, 8 Mar 2022 13:48:05 +0100 Subject: [PATCH] ci: add release automation (#80) 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 --- .github/actions/unit-tests/action.yaml | 8 ++---- .github/workflows/CI.yaml | 3 +- .github/workflows/pre-release.yaml | 33 ++++++++++++++++++++++ .github/workflows/release.yaml | 32 +++++++++++++++++++++ .github/workflows/validate-semantic-pr.yml | 2 +- package.json | 2 +- 6 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/pre-release.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/actions/unit-tests/action.yaml b/.github/actions/unit-tests/action.yaml index c32fb75..38fdf37 100644 --- a/.github/actions/unit-tests/action.yaml +++ b/.github/actions/unit-tests/action.yaml @@ -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" @@ -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 typescript@4.0.2 diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 68d8b78..038e436 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -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 # @@ -33,4 +33,3 @@ jobs: with: KEPTN_API_ENDPOINT: http://somekeptninstall.mock/api KEPTN_API_TOKEN: somefancysupersecrettoken - diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml new file mode 100644 index 0000000..6acd092 --- /dev/null +++ b/.github/workflows/pre-release.yaml @@ -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/pre-release-integration.yml@v1.5.1 + + 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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d986014 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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/release-integration.yml@v1.5.1 + + 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 diff --git a/.github/workflows/validate-semantic-pr.yml b/.github/workflows/validate-semantic-pr.yml index 8b2d22d..e1fb851 100644 --- a/.github/workflows/validate-semantic-pr.yml +++ b/.github/workflows/validate-semantic-pr.yml @@ -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: | diff --git a/package.json b/package.json index a1545c4..ddf8d45 100644 --- a/package.json +++ b/package.json @@ -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",