fix: use logger instead of console.log #468
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release workflow | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
GHR_PROJECT_REPONAME: ui5-language-assistant | |
GHR_PROJECT_USERNAME: SAP | |
jobs: | |
build: | |
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 | |
- name: Run SonarCloud scan | |
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Upload vsix artifact | |
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' && github.event_name == 'push' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: vscode-extension-file | |
path: ./packages/vscode-ui5-language-assistant/vscode-ui5-language-assistant*.vsix | |
retention-days: 1 | |
if-no-files-found: error | |
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.repository == 'SAP/ui5-language-assistant' && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [14.x] | |
runs-on: ${{ matrix.os }} | |
needs: [build, compliance] | |
outputs: | |
changes: ${{ steps.changesetVersion.outputs.changes }} # map step output to job output | |
steps: | |
- name: Checkout code repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.ACCESS_PAT }} # needed to auto trigger release job | |
- 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 | |
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 github-actions@github.com | |
git status | |
git add -A | |
git status | |
git commit -m "chore: apply latest changesets" --no-verify || echo "No changesets found" | |
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 --follow-tags | |
release: | |
if: github.repository == 'SAP/ui5-language-assistant' && github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.version.outputs.changes == 'false' | |
runs-on: [ubuntu-latest] | |
needs: version | |
steps: | |
- name: Checkout code repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# 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 | |
# Get new version number | |
- name: get-npm-version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@main | |
with: | |
path: ./packages/vscode-ui5-language-assistant | |
# Publish on GitHub | |
- name: Create Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }} # A personal access token | |
CURRENT_RELEASE_VERSION: ${{steps.package-version.outputs.current-version}} | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
draft: false | |
prerelease: false | |
name: Release v${{env.CURRENT_RELEASE_VERSION}} | |
tag: v${{env.CURRENT_RELEASE_VERSION}} | |
owner: ${{env.GHR_PROJECT_USERNAME}} | |
repo: ${{env.GHR_PROJECT_REPONAME}} | |
artifacts: './artifacts/*-${{env.CURRENT_RELEASE_VERSION}}.vsix' |