Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into feature/copy/dsMulti

Signed-off-by: zFernand0 <[email protected]>
  • Loading branch information
zFernand0 committed Feb 24, 2023
2 parents 235dff7 + 4aa6d95 commit 7bfd20a
Show file tree
Hide file tree
Showing 54 changed files with 823 additions and 1,644 deletions.
77 changes: 77 additions & 0 deletions .github/release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
branches: [
{
name: "main",
channel: "latest",
level: "minor",
},
{
name: "maintenance",
channel: "latest",
level: "patch",
},
{
name: "v1-lts",
channel: "zowe-v1-lts",
level: "patch",
},
// {
// name: "next",
// prerelease: true,
// }
],
plugins: [
[
"@octorelease/changelog",
{
displayNames: {
"zowe-explorer": "Zowe Explorer",
"zowe-explorer-ftp-extension": "Zowe Explorer Extension for FTP",
"zowe-explorer-api": "Zowe Explorer APIs",
},
headerLine: "## TBD Release",
},
],
[
"@octorelease/lerna",
{
// Use Lerna only for versioning and publish packages independently
npmPublish: false,
},
],
[
"@octorelease/npm",
{
$cwd: "packages/zowe-explorer-api",
aliasTags: {
"latest": ["zowe-v2-lts"],
},
npmPublish: true,
tarballDir: "dist",
},
],
[
"@octorelease/vsce",
{
$cwd: "packages/zowe-explorer",
ovsxPublish: true,
vscePublish: true,
vsixDir: "dist",
},
{
$cwd: "packages/zowe-explorer-ftp-extension",
ovsxPublish: true,
vscePublish: true,
vsixDir: "dist",
},
],
[
"@octorelease/github",
{
assets: ["dist/*.tgz", "dist/*.vsix"],
draftRelease: true,
},
],
"@octorelease/git",
],
};
242 changes: 45 additions & 197 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,225 +4,73 @@ on:
push:
branches:
- main
- maintenance
- v1-lts
paths:
- package.json
workflow_dispatch:
inputs:
version:
description: Version to be published
default: v2.6.0
required: false
# create_release:
# description: Create the release even if publishing already happened
# default: 'false'
# required: false
- .github/release.config.js
- .github/workflows/deployment.yml
- lerna.json
# workflow_dispatch:
# inputs:
# version:
# description: Override version to be published
# required: false

jobs:
check_version:
release:
if: github.event_name == 'workflow_dispatch' || github.ref_protected
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.should_publish_any.outputs.should_publish != null }}
steps:
- name: Checkout the Source Code
uses: actions/checkout@v2

- name: Get Top-Level package.json
run: "echo ::set-output name=market_ze::$(cat package.json)"
id: get_info

- name: Get the Zowe Explorer package.json
run: "echo ::set-output name=package::$(cat packages/zowe-explorer/package.json)"
id: get_ze_package

- name: Get the Zowe Explorer - FTP Extension package.json
run: "echo ::set-output name=package::$(cat packages/zowe-explorer-ftp-extension/package.json)"
id: get_ze_ftp_package

- name: Get the Zowe Explorer - API package.json
run: "echo ::set-output name=package::$(cat packages/zowe-explorer-api/package.json)"
id: get_ze_api_package

- name: Get the Zowe Explorer - ESLint Extension package.json
run: "echo ::set-output name=package::$(cat packages/eslint-plugin-zowe-explorer/package.json)"
id: get_ze_eslint_package

- name: Verify that Deployment is Required
run: "echo ::set-output name=should_publish::true"
if: |
fromJson(steps.get_info.outputs.market_ze).versions[0].version != fromJson(steps.get_ze_package.outputs.package).version ||
fromJson(steps.get_info.outputs.market_ze).versions[0].version != fromJson(steps.get_ze_ftp_package.outputs.package).version ||
fromJson(steps.get_info.outputs.market_ze).versions[0].version != fromJson(steps.get_ze_api_package.outputs.package).version
# if: |
# fromJson(steps.get_info.outputs.market_ze).versions[0].version != fromJson(steps.get_ze_package.outputs.package).version ||
# fromJson(steps.get_info.outputs.market_ze).versions[0].version != fromJson(steps.get_ze_ftp_package.outputs.package).version ||
# fromJson(steps.get_info.outputs.market_ze).versions[0].version != fromJson(steps.get_ze_api_package.outputs.package).version ||
# fromJson(steps.get_info.outputs.market_ze).versions[0].version != fromJson(steps.get_ze_eslint_package.outputs.package).version
id: should_publish_any

deploy:
runs-on: ubuntu-latest
needs: check_version
if: needs.check_version.outputs.should_publish
steps:
- name: Checkout the Source Code
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.ref }}

- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: 14

- name: Configure Git
run: |
git config --global user.name "zowe-robot"
git config --global user.email "[email protected]"
node-version: 'lts/*'
cache: 'npm'

- name: Install CLIs for Workflow use
run: npm install -g [email protected] yarn ovsx
- name: Install Yarn
run: npm install -g yarn

# Avoid adding node_modules to each .github/actions folder
- name: Install Internal Dependencies for Actions to Work
run: npm install @actions/core
working-directory: ./.github/actions/deploy-vscode-extension

- name: Install Project Dependencies
- name: Build Source
run: yarn

# TODO: Update ZE dependency on the ze-api to match the top-level version once published
# Maybe this will help https://yarnpkg.com/cli/version/apply

- name: Get the Zowe Explorer Display Name
run: "echo ::set-output name=package_nls::$(cat packages/zowe-explorer/package.nls.json)"
id: get_ze_name

- name: Publish the Zowe Explorer
id: deploy_zowe_explorer
uses: ./.github/actions/deploy-vscode-extension
with:
name: ${{ fromJson(steps.get_ze_name.outputs.package_nls).displayName }}
package: packages/zowe-explorer
token: ${{ secrets.VSCODE_PUBLISHER_TOKEN }} ${{ secrets.VSCODE_ZOWE_ROBOT_PUBLISH_TOKEN }}

- name: Get the FTP Extension package.json
run: "echo ::set-output name=package::$(cat packages/zowe-explorer-ftp-extension/package.json)"
id: get_ftp_name
- name: Get Project Version
id: lerna
run: echo "version=$(jq -r .version lerna.json)" >> $GITHUB_OUTPUT

- name: Publish the FTP Extension for Zowe Explorer
id: deploy_zowe_explorer_ftp_extension
uses: ./.github/actions/deploy-vscode-extension
with:
name: ${{ fromJson(steps.get_ftp_name.outputs.package).displayName }}
package: packages/zowe-explorer-ftp-extension
token: ${{ secrets.VSCODE_PUBLISHER_TOKEN }} ${{ secrets.VSCODE_ZOWE_ROBOT_PUBLISH_TOKEN }}

- name: Get the NPM API package.json
run: "echo ::set-output name=package::$(cat packages/zowe-explorer-api/package.json)"
id: get_npm_api_info

- name: Publish the Zowe Explorer APIs
id: deploy_zowe_explorer_api
uses: ./.github/actions/deploy-npm-package
with:
name: ${{ fromJson(steps.get_npm_api_info.outputs.package).description }}
package: packages/zowe-explorer-api
token: ${{ secrets.NPM_PUBLISHER_TOKEN }}

# - name: Publish the ESLint plugin for Zowe Explorer
# id: deploy_eslint_plugin_zowe_explorer
# uses: ./.github/actions/deploy-eslint-plugin-zowe-explorer
# with:
# package: packages/eslint-plugin-zowe-explorer

- name: Create Packages for Archiving Purposes
run: yarn package

- name: Archive Built Artifacts
uses: actions/upload-artifact@v2
with:
name: zowe-explorer-artifacts
path: dist/*

- name: Get Top-Level package.json
run: "echo ::set-output name=top_package::$(cat package.json)"
id: get_version
- name: Get most recent GitHub release version
id: get_gh_version
uses: "WyriHaximus/github-action-get-previous-tag@v1"

# Removed step because of issues with publishing
# - name: Check if files were staged
# run: "echo ::set-output name=files_staged::$(git diff --cached --quiet || echo $?)"
# id: check_project

- name: Check version is bumped
if: ${{ !contains(steps.get_gh_version.outputs.tag, fromJson(steps.get_version.outputs.top_package).version) }}
run: echo "::set-output name=version_bumped::true"
id: check_project

- name: Check version is a pre-release
if: ${{ endsWith(fromJson(steps.get_version.outputs.top_package).version, 'SNAPSHOT') }}
run: echo "::set-output name=pre_release::true"
id: is_pre_release

- name: Create the Release
if: steps.check_project.outputs.version_bumped && !steps.is_pre_release.outputs.pre_release
id: create_release
uses: actions/create-release@v1
- uses: zowe-actions/octorelease@master
id: octorelease
if: ${{ !contains(github.event.inputs.version || steps.lerna.outputs.version, '-SNAPSHOT') }}
env:
GIT_COMMITTER_NAME: ${{ secrets.ZOWE_ROBOT_USER }}
GIT_COMMITTER_EMAIL: ${{ secrets.ZOWE_ROBOT_EMAIL }}
GIT_CREDENTIALS: x-access-token:${{ secrets.ZOWE_ROBOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISHER_TOKEN }}
OVSX_PAT: ${{ secrets.VSCODE_ZOWE_ROBOT_PUBLISH_TOKEN }}
VSCE_PAT: ${{ secrets.VSCODE_PUBLISHER_TOKEN }}
with:
tag_name: v${{ fromJson(steps.get_version.outputs.top_package).version }}
release_name: v${{ fromJson(steps.get_version.outputs.top_package).version }}
body: |
${{ steps.deploy_zowe_explorer.outputs.changelog }}
${{ steps.deploy_zowe_explorer_ftp_extension.outputs.changelog }}
${{ steps.deploy_zowe_explorer_api.outputs.changelog }}
${{ steps.deploy_eslint_plugin_zowe_explorer.outputs.changelog }}
draft: true
prerelease: false
config-dir: .github
new-version: ${{ github.event.inputs.version }}

- name: Upload the Zowe Explorer Assets
if: steps.check_project.outputs.version_bumped && !steps.is_pre_release.outputs.pre_release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/${{ steps.deploy_zowe_explorer.outputs.archive }}.vsix
asset_name: ${{ steps.deploy_zowe_explorer.outputs.archive }}.vsix
asset_content_type: application/octet-stream

- name: Upload the FTP Extension for Zowe Explorer Assets
if: steps.check_project.outputs.version_bumped && !steps.is_pre_release.outputs.pre_release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/${{ steps.deploy_zowe_explorer_ftp_extension.outputs.archive }}.vsix
asset_name: ${{ steps.deploy_zowe_explorer_ftp_extension.outputs.archive }}.vsix
asset_content_type: application/octet-stream
- name: Update Changelogs
if: steps.octorelease.outcome == 'success'
run: |
sed -i '0,/##/s//## TBD Release\n\n### New features and enhancements\n\n### Bug fixes\n\n##/' packages/*/CHANGELOG.md
git add packages/*/CHANGELOG.md
- name: Upload the Zowe Explorer APIs Assets
if: steps.check_project.outputs.version_bumped && !steps.is_pre_release.outputs.pre_release
uses: actions/upload-release-asset@v1
- name: Create Snapshot Version
if: steps.octorelease.outcome == 'success'
uses: zowe-actions/octorelease/script@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_STRING: "%s-SNAPSHOT"
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/${{ steps.deploy_zowe_explorer_api.outputs.archive }}.tgz
asset_name: ${{ steps.deploy_zowe_explorer_api.outputs.archive }}.tgz
asset_content_type: application/octet-stream
# - name: Upload the ESLint plugin for Zowe Explorer Assets
# if: steps.check_project.outputs.version_bumped
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./dist/${{ steps.deploy_eslint_plugin_zowe_explorer.outputs.archive }}.tgz
# asset_name: ${{ steps.deploy_eslint_plugin_zowe_explorer.outputs.archive }}.tgz
# asset_content_type: application/octet-stream
config-dir: .github
script: prepareRelease
Loading

0 comments on commit 7bfd20a

Please sign in to comment.