-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release setup #13
Release setup #13
Changes from all commits
86e09cf
903e51b
0ae6f8f
0420799
057d02d
262bb37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this workflow, I think it's important that we get notifications for success / failure similar to https://cloud-native.slack.com/archives/C04LY4Y3EHF/p1698337431944799 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me do that as an improvement later, ok? Created #14 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Publish release on NPM | ||
|
||
on: | ||
# When manually triggered | ||
workflow_dispatch: | ||
Comment on lines
+4
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this manual trigger have inputs ? Otherwise There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can select the branch in GitHub UI and then trigger the workflow. No need for any inputs. ...unless there's something I am missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be good now |
||
inputs: | ||
releaseName: | ||
description: 'Release name, e.g. v1.2.3' | ||
required: true | ||
|
||
# When there's a release created | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
publish-release-on-npm: | ||
name: Publish release on NPM | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup release name | ||
run: | | ||
if [ -z "${{ github.event.release.name }}" ]; then | ||
echo "RELEASE_NAME=${{ github.event.inputs.releaseName }}" >> $GITHUB_ENV | ||
else | ||
echo "RELEASE_NAME=${{ github.event.release.name }}" >> $GITHUB_ENV | ||
fi | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: 'backstage/.nvmrc' | ||
cache: 'yarn' | ||
cache-dependency-path: 'backstage/yarn.lock' | ||
|
||
- name: Print environment | ||
run: | | ||
node --version | ||
yarn --version | ||
|
||
- name: Print release name | ||
run: | | ||
echo "Release name: ${RELEASE_NAME}" | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
working-directory: ./backstage | ||
run: yarn --prefer-offline --frozen-lockfile | ||
|
||
- name: Install tooling | ||
shell: bash | ||
working-directory: ./backstage | ||
run: npm install @backstage/cli -g | ||
|
||
- name: Run tests | ||
shell: bash | ||
working-directory: ./backstage | ||
run: | | ||
export PATH="./node_modules/.bin/:$PATH" | ||
yarn test | ||
Comment on lines
+58
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running tests here seems a good additional check, however, I think we need to run the tests before Prow publishes a release in the Prow jobs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created #21 |
||
|
||
- name: Build | ||
shell: bash | ||
working-directory: ./backstage | ||
run: | | ||
export PATH="./node_modules/.bin/:$PATH" | ||
yarn tsc | ||
yarn build | ||
|
||
- name: Update version of knative-event-mesh-backend plugin | ||
shell: bash | ||
working-directory: ./backstage/plugins/knative-event-mesh-backend | ||
run: | | ||
export PATH="./node_modules/.bin/:$PATH" | ||
yarn version --new-version ${RELEASE_NAME} --no-git-tag-version | ||
|
||
- name: Publish knative-event-mesh-backend plugin | ||
uses: JS-DevTools/npm-publish@v2 | ||
with: | ||
token: ${{ secrets.NPM_TOKEN }} | ||
access: public | ||
package: backstage/plugins/knative-event-mesh-backend |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"packages": ["packages/*", "plugins/*"], | ||
"npmClient": "yarn", | ||
"version": "0.1.0", | ||
"version": "0.0.0-nightly", | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# keep this file so that npm doesn't use the .gitignore file | ||
src/ | ||
.eslintrc.js | ||
app-config.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 The Knative Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Documentation about this script and how to use it can be found | ||
# at https://github.com/knative/test-infra/tree/master/ci | ||
|
||
source $(dirname $0)/../vendor/knative.dev/hack/release.sh | ||
Check failure on line 20 in hack/release.sh GitHub Actions / style / suggester / shell
|
||
|
||
export GO111MODULE=on | ||
|
||
# Yaml files to generate, and the source config dir for them. | ||
declare -A COMPONENTS | ||
COMPONENTS=( | ||
["eventmesh.yaml"]="backends/config/100-eventmesh" | ||
) | ||
readonly COMPONENTS | ||
|
||
function build_release() { | ||
# Update release labels if this is a tagged release | ||
if [[ -n "${TAG}" ]]; then | ||
echo "Tagged release, updating release labels to app.kubernetes.io/version: \"${TAG}\"" | ||
LABEL_YAML_CMD=(sed -e "s|app.kubernetes.io/version: devel|app.kubernetes.io/version: \"${TAG}\"|") | ||
else | ||
echo "Untagged release, will NOT update release labels" | ||
LABEL_YAML_CMD=(cat) | ||
fi | ||
|
||
local all_yamls=() | ||
for yaml in "${!COMPONENTS[@]}"; do | ||
local config="${COMPONENTS[${yaml}]}" | ||
echo "Building Knative Backstage Backends - ${config}" | ||
ko resolve -j 1 ${KO_FLAGS} -f ${config}/ | "${LABEL_YAML_CMD[@]}" > ${yaml} | ||
Check failure on line 45 in hack/release.sh GitHub Actions / style / suggester / shell
|
||
all_yamls+=(${yaml}) | ||
done | ||
|
||
ARTIFACTS_TO_PUBLISH="${all_yamls[@]}" | ||
} | ||
|
||
main $@ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 The Knative Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This script runs the presubmit tests; it is started by prow for each PR. | ||
# For convenience, it can also be executed manually. | ||
# Running the script without parameters, or with the --all-tests | ||
# flag, causes all tests to be executed, in the right order. | ||
# Use the flags --build-tests, --unit-tests and --integration-tests | ||
# to run a specific set of tests. | ||
|
||
export GO111MODULE=on | ||
export DISABLE_MD_LINTING=1 | ||
|
||
source $(dirname "$0")/../vendor/knative.dev/hack/presubmit-tests.sh | ||
|
||
main $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prow publishes nightly releases, should we do the same for the NPM package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely can. I don't think I would bind the NPM publish to the Prow's schedule then. Just a periodic (or, whenever something is pushed) that lives on Github actions.
Created #15, thanks for the idea.