Skip to content

fix: added nx caching #663

fix: added nx caching

fix: added nx caching #663

Workflow file for this run

name: Release workflow
on:
push:
branches: [feat/pnpm]
pull_request:
branches: [feat/pnpm]
env:
GHR_PROJECT_REPONAME: ui5-language-assistant
GHR_PROJECT_USERNAME: SAP
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # will fetch all history
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: true
- name: Cache pnpm modules
uses: actions/cache@v4
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ matrix.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ matrix.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- name: Install pnpm modules
run: pnpm install
- name: Run build
run: pnpm ci
- 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: [18.x, 20.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: Install pnpm modules
run: pnpm install
- 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'