Update copy-main-branch.yml for Azure Pipelines #52
This file contains hidden or 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 Library | |
# Job will only run on push to the main branch after the test job has passed | |
on: | |
push: | |
branches: ['main'] | |
paths-ignore: | |
- '.github/**' | |
- 'docs/**' | |
- 'assets/**' | |
- '*.yml' | |
- '*.json' | |
- '*.config' | |
- '!packages/**' | |
workflow_dispatch: | |
inputs: {} | |
concurrency: | |
group: 'release-library' | |
cancel-in-progress: true | |
env: | |
ARTIFACT_NAME: 'build-lib-artifact' | |
jobs: | |
release: | |
if: | | |
github.ref == 'refs/heads/main' && | |
github.event.repository.fork == false && | |
github.actor != 'dependabot[bot]' | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
environment: FSI_DEP_NodeJs | |
strategy: | |
matrix: | |
package: [ | |
abcdef, | |
abyss, | |
android-studio, | |
andromeda, | |
basic-dark, | |
basic-light, | |
forest, | |
github-dark, | |
github-light, | |
gruvbox-dark, | |
gruvbox-light, | |
material-dark, | |
material-light, | |
monokai, | |
nord, | |
palenight, | |
solarized-dark, | |
solarized-light, | |
tokyo-night-day, | |
tokyo-night-storm, | |
volcano, | |
vscode-dark, | |
vscode-light, | |
# This is a special package that bundles all themes together and is published as a separate package at the end to avoid conflicts with individual themes | |
bundle | |
] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js - Version ${{ vars.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
registry-url: 'https://registry.npmjs.org/' | |
scope: ${{ vars.NPM_ORG }} | |
always-auth: true | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm install --no-audit | |
- name: Build ${{ matrix.package }} package | |
run: | | |
cd packages/${{ matrix.package }} | |
npm run prepare | |
- name: Get package version | |
id: get_version | |
run: echo "VERSION=$(jq -r .version < packages/${{ matrix.package }}/package.json)" >> $GITHUB_ENV | |
- name: Determine tag | |
id: determine_tag | |
run: | | |
VERSION=${{ steps.get_version.outputs.VERSION }} | |
if [[ "$VERSION" == *"-beta"* ]]; then | |
echo "TAG=beta" >> $GITHUB_OUTPUT | |
elif [[ "$VERSION" == *"-alpha"* ]]; then | |
echo "TAG=alpha" >> $GITHUB_OUTPUT | |
elif [[ "$VERSION" == *"-rc"* ]]; then | |
echo "TAG=rc" >> $GITHUB_OUTPUT | |
elif [[ "$VERSION" == *"-next"* ]]; then | |
echo "TAG=next" >> $GITHUB_OUTPUT | |
else | |
echo "TAG=latest" >> $GITHUB_OUTPUT | |
fi | |
- name: Release to NPM registry 🚀 | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
cd packages/${{ matrix.package }} | |
npm publish --tag ${{ steps.determine_tag.outputs.TAG }} --access public || echo "Package already published in NPM, skipping..." | |
- name: Set up Node.js for GitHub registry | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
registry-url: 'https://npm.pkg.github.com/' | |
scope: ${{ vars.NPM_ORG }} | |
always-auth: true | |
- name: Release to GitHub NPM registry 🚀 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_GH_TOKEN }} | |
run: | | |
cd packages/${{ matrix.package }} | |
npm publish --tag ${{ steps.determine_tag.outputs.TAG }} || echo "Package already published in GitHub NPM, skipping..." |