Skip to content

Commit 198cc8f

Browse files
authored
feat: migration to github actions (#575)
* feat: migration to github actions * feat: npm deploy enabled
1 parent d309013 commit 198cc8f

File tree

8 files changed

+791
-156
lines changed

8 files changed

+791
-156
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "master",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/proud-deers-ring.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"vscode-ui5-language-assistant": patch
3+
"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch
4+
---
5+
6+
Migration from CircleCI to GitHub actions

.circleci/config.yml

Lines changed: 0 additions & 134 deletions
This file was deleted.

.github/workflows/deploy_maual.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Manual latest release deploy to npmjs
2+
3+
on:
4+
# Trigger the workflow only manually
5+
workflow_dispatch:
6+
7+
jobs:
8+
deploy-npm:
9+
if: github.repository == 'SAP/ui5-language-assistant' && github.ref == 'refs/heads/master'
10+
runs-on: [ubuntu-latest]
11+
12+
steps:
13+
- name: Checkout code repository
14+
uses: actions/checkout@v3
15+
16+
- name: Setup node
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 14
20+
21+
- name: Download latest released artifact
22+
uses: robinraju/[email protected]
23+
with:
24+
latest: true
25+
token: ${{ secrets.ACCESS_PAT }}
26+
fileName: "vscode-ui5-language-assistant-*.vsix"
27+
out-file-path: "./packages/vscode-ui5-language-assistant-bas-ext"
28+
29+
- name: List folder content
30+
run: ls ./packages/vscode-ui5-language-assistant-bas-ext -la
31+
32+
- name: Check file existence
33+
uses: andstor/file-existence-action@v2
34+
with:
35+
files: "./packages/vscode-ui5-language-assistant-bas-ext/*.vsix"
36+
fail: true
37+
38+
- name: Prepare .npmrc
39+
run:
40+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
41+
42+
# To help debug when lerna detects changes to the working tree and fails the publish
43+
- name: Status
44+
run: git status
45+
46+
- name: Publish
47+
# https://github.com/lerna/lerna/issues/2788
48+
uses: borales/actions-yarn@v4
49+
with:
50+
cmd: release:publish --no-verify-access
51+
52+

.github/workflows/release.yaml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Release workflow
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
env:
10+
GHR_PROJECT_REPONAME: ui5-language-assistant
11+
GHR_PROJECT_USERNAME: SAP
12+
13+
jobs:
14+
build:
15+
if: github.ref == 'refs/heads/master' # to filter out tag pushes
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest]
19+
node-version: [14.x, 16.x, 18.x]
20+
runs-on: ${{ matrix.os }}
21+
steps:
22+
- name: Checkout code repository
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0 # will fetch all history
26+
- name: Run install
27+
uses: borales/actions-yarn@v4
28+
with:
29+
cmd: install # will run `yarn install` command
30+
- name: Run build
31+
uses: borales/actions-yarn@v4
32+
with:
33+
cmd: ci # will run `yarn run ci` command
34+
35+
- name: Upload vsix artifact
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: vscode-extension-file
39+
path: ./packages/vscode-ui5-language-assistant/vscode-ui5-language-assistant*.vsix
40+
retention-days: 1
41+
if-no-files-found: error
42+
43+
compliance:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: REUSE Compliance Check
48+
uses: fsfe/reuse-action@v1
49+
with:
50+
args: --include-submodules lint
51+
52+
version:
53+
# Run version job only on pushes to the main branch. The job depends on completion of the build job.
54+
if: github.repository == 'SAP/ui5-language-assistant' && github.event_name == 'push' && github.ref == 'refs/heads/master'
55+
runs-on: ubuntu-latest
56+
needs: [build, compliance]
57+
outputs:
58+
changes: ${{ steps.changesetVersion.outputs.changes }} # map step output to job output
59+
60+
steps:
61+
- name: Checkout code repository
62+
uses: actions/checkout@v3
63+
with:
64+
fetch-depth: 0
65+
token: ${{ secrets.ACCESS_PAT }} # needed to auto trigger release job
66+
- name: Setup node
67+
uses: actions/setup-node@v3
68+
with:
69+
node-version: 14
70+
71+
- name: Run install
72+
uses: borales/actions-yarn@v4
73+
with:
74+
cmd: install # will run `yarn install` command
75+
76+
- name: Apply changesets
77+
id: changesetVersion
78+
run: |
79+
echo ::set-output name=changes::$(npm run ci:version 2>&1 | grep -q 'No unreleased changesets found' && echo 'false' || echo 'true')
80+
git status
81+
82+
# Get new version number
83+
- name: get-npm-version
84+
id: package-version
85+
uses: martinbeentjes/npm-get-version-action@main
86+
with:
87+
path: ./packages/vscode-ui5-language-assistant
88+
89+
# Apply changes and create version tag
90+
- name: Commit and push changes
91+
if: steps.changesetVersion.outputs.changes == 'true'
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }}
94+
run: |
95+
echo ${{ steps.package-version.outputs.current-version}}
96+
git config user.name github-actions
97+
git config user.email [email protected]
98+
git status
99+
git add -A
100+
git status
101+
git commit -m "chore: apply latest changesets" --no-verify || echo "No changesets found"
102+
git tag -a "v${{ steps.package-version.outputs.current-version}}" -m "v${{ steps.package-version.outputs.current-version}} release"
103+
git log --pretty=oneline | head -n 10
104+
git push --follow-tags
105+
106+
release:
107+
if: github.repository == 'SAP/ui5-language-assistant' && github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.version.outputs.changes == 'false'
108+
runs-on: [ubuntu-latest]
109+
needs: version
110+
steps:
111+
- name: Checkout code repository
112+
uses: actions/checkout@v3
113+
with:
114+
fetch-depth: 0
115+
116+
# Download vsix artifact
117+
- name: 'make folder'
118+
run: mkdir ./artifacts
119+
- name: Download artifact
120+
uses: actions/download-artifact@v3
121+
with:
122+
name: vscode-extension-file
123+
path: ./artifacts
124+
125+
- name: 'check artifacts'
126+
run: ls ./artifacts -la
127+
128+
# Get new version number
129+
- name: get-npm-version
130+
id: package-version
131+
uses: martinbeentjes/npm-get-version-action@main
132+
with:
133+
path: ./packages/vscode-ui5-language-assistant
134+
135+
# Publish on GitHub
136+
- name: Create Release
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }} # A personal access token
139+
CURRENT_RELEASE_VERSION: ${{steps.package-version.outputs.current-version}}
140+
uses: ncipollo/release-action@v1
141+
with:
142+
allowUpdates: true
143+
draft: false
144+
prerelease: false
145+
name: Release v${{env.CURRENT_RELEASE_VERSION}}
146+
tag: v${{env.CURRENT_RELEASE_VERSION}}
147+
owner: ${{env.GHR_PROJECT_USERNAME}}
148+
repo: ${{env.GHR_PROJECT_REPONAME}}
149+
artifacts: './artifacts/*-${{env.CURRENT_RELEASE_VERSION}}.vsix'

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@
3131
"legal:copy": "lerna exec \"shx cp -r ../../.reuse .reuse && shx cp -r ../../LICENSES LICENSES\"",
3232
"prepare": "node ./.husky/skip.js || husky install",
3333
"hooks:pre-commit": "lint-staged",
34-
"hooks:commit-msg": "commitlint -e"
34+
"hooks:commit-msg": "commitlint -e",
35+
"cset": "changeset",
36+
"ci:version": "changeset version"
3537
},
3638
"devDependencies": {
39+
"@changesets/cli": "2.26.0",
3740
"@commitlint/cli": "11.0.0",
3841
"@commitlint/config-conventional": "11.0.0",
3942
"@types/chai": "4.2.14",

0 commit comments

Comments
 (0)