Skip to content
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

Feat/migrate to GitHub actions #572

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
134 changes: 0 additions & 134 deletions .circleci/config.yml

This file was deleted.

134 changes: 134 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Release workflow

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

env:
GHR_PROJECT_REPONAME: ui5-language-assistant
GHR_PROJECT_USERNAME: SAP

jobs:
build:
if: github.repository == 'vadson71/ui5-language-assistant-vk' && contains(github.ref, 'refs/tags/v')
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14.x, 16.x, 18.x]
runs-on: ${{ matrix.os }}
outputs:
changes: ${{ steps.package-version.outputs.current-version }} # map step output to job output

steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # will fetch all history
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
- name: Run build
uses: borales/actions-yarn@v4
with:
cmd: ci # will run `yarn run ci` command

- name: Upload vsix artifact
uses: actions/upload-artifact@v3
with:
name: vscode-extension-file
path: ./packages/vscode-ui5-language-assistant/vscode-ui5-language-assistant*.vsix
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`

# Get release version number
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: ./packages/vscode-ui5-language-assistant

gh-delpoy:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14.x]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Setup Go 1.18
uses: actions/setup-go@v3
with:
go-version: '^1.18'
- name: 'prepare to deploy'
run:
go version

# Download vsix artifact
- name: 'make folder'
run: mkdir ./artifacts
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: vscode-extension-file
path: ./artifacts
- name: 'check artifacts'
run: ls ./artifacts -la

# Publish on GitHub
- name: 'Publish Release on GitHub'
# run: echo 'export GOPATH=~/go' >> $BASH_ENV
run: go install github.com/tcnksm/ghr@latest

- name: Check
run: echo ${{ secrets.GITHUB_TOKEN }} -u ${{env.GHR_PROJECT_USERNAME}} -r ${{env.GHR_PROJECT_REPONAME}} -replace ${{ needs.build.outputs.current-version}} ./artifacts/
# ghr -t ${{ secrets.GITHUB_TOKEN }} -u ${{env.GHR_PROJECT_USERNAME}} -r ${{env.GHR_PROJECT_REPONAME}} -replace ${{ needs.build.outputs.current-version}} ./artifacts/

deploy-npm:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14.x]
runs-on: ${{ matrix.os }}
needs: build

steps:
- name: Prerequisite
run: sudo apt-get install libxss1

- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # will fetch all history

# Pure lockfile simply doesn't write the lockfile if it has changes.
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install --pure-lockfile

# reuse stored generated vsix
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: vscode-extension-file
path: ./packages/vscode-ui5-language-assistant-bas-ext

- name: Check
run: ls ./packages/vscode-ui5-language-assistant-bas-ext -la

- name: Prepare .npmrc
run:
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc

# To help debug when lerna detects changes to the working tree and fails the publish
- name: Status
run: git status

# - name: Publish
# # https://github.com/lerna/lerna/issues/2788
# uses: borales/actions-yarn@v4
# with:
# cmd: run release:publish --no-verify-access


91 changes: 91 additions & 0 deletions .github/workflows/version_manual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Version bump for release workflow

on:
# Trigger the workflow only manually
workflow_dispatch:

jobs:
build:
if: github.ref == 'refs/heads/master'
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14.x, 16.x, 18.x]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # will fetch all history
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
- name: Run build
uses: borales/actions-yarn@v4
with:
cmd: ci # will run `yarn run ci` command

compliance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
with:
args: --include-submodules lint

version:
# Run version job only on pushes to the main branch. The job depends on completion of the build job.
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [build, compliance]
steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.ACCESS_PAT }} # needed to auto trigger release job
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 14

- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command

- name: Apply changesets
id: changesetVersion
run: |
echo ::set-output name=changes::$(npm run ci:version 2>&1 | grep -q 'No unreleased changesets found' && echo 'false' || echo 'true')
git status

# Get new version number
- name: get-npm-version
if: steps.changesetVersion.outputs.changes == 'true'
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: ./packages/vscode-ui5-language-assistant

# Apply changes and create version tag
- name: Commit and push changes
if: steps.changesetVersion.outputs.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }}
run: |
echo ${{ steps.package-version.outputs.current-version}}
git config user.name github-actions
git config user.email [email protected]
git status
git add -A
git status
git commit -m "chore: apply latest changesets" --no-verify || echo "No changesets found"
git log --pretty=oneline | head -n 10
git tag -a "v${{ steps.package-version.outputs.current-version}}" -m "v${{ steps.package-version.outputs.current-version}} release"
git log --pretty=oneline | head -n 10
git push
git push --tags
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@
"legal:copy": "lerna exec \"shx cp -r ../../.reuse .reuse && shx cp -r ../../LICENSES LICENSES\"",
"prepare": "node ./.husky/skip.js || husky install",
"hooks:pre-commit": "lint-staged",
"hooks:commit-msg": "commitlint -e"
"hooks:commit-msg": "commitlint -e",
"cset": "changeset",
"ci:version": "changeset version"
},
"devDependencies": {
"@changesets/cli": "2.24.1",
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"@types/chai": "4.2.14",
Expand Down
Loading