Skip to content

Merge pull request #2665 from GlobalFishingWatch/image-labeler/kick-off #218

Merge pull request #2665 from GlobalFishingWatch/image-labeler/kick-off

Merge pull request #2665 from GlobalFishingWatch/image-labeler/kick-off #218

name: i18n-labels 🚀 to dev|latest
on:
push:
branches:
- develop
paths:
- 'libs/i18n-labels/**'
# Exclude to prevent infinite loop
- '!libs/i18n-labels/package.json'
- '!libs/i18n-labels/CHANGELOG.md'
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PA_TOKEN }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '21'
registry-url: https://registry.npmjs.org/
- name: Setup Git
run: |
git config user.name "Github Action"
git config user.email "[email protected]"
- name: Install yarn
run: npm install -g yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn dependencies
uses: actions/cache@v2
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**\node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: Lib Changes
shell: bash
run: |
yarn affected:libs
LIB_AFFECTED=`cat affected-libs.txt`
echo LIB_AFFECTED: $LIB_AFFECTED
[[ $LIB_AFFECTED = 'i18n-labels' ]] && I18N_LABELS_AFFECTED="true" || I18N_LABELS_AFFECTED="false"
echo "##[set-output name=i18n-labels-affected;]$(echo $I18N_LABELS_AFFECTED)"
id: lib-changes
- name: Bump version
if: ${{ steps.lib-changes.outputs.i18n-labels-affected == 'true' }}
shell: bash
run: yarn nx version i18n-labels
- name: Tag i18n-labels@latest
if: steps.lib-changes.outputs.i18n-labels-affected == 'true'
shell: bash
run: git tag -f i18n-labels@latest
- name: Push changes
if: steps.lib-changes.outputs.i18n-labels-affected == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_PA_TOKEN }}
branch: ${{ github.ref }}
force: true
tags: true
- name: Publish to NPM
if: steps.lib-changes.outputs.i18n-labels-affected == 'true'
shell: bash
run: npx nx publish i18n-labels
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Purge jsdelivr cache
if: steps.lib-changes.outputs.i18n-labels-affected == 'true'
shell: bash
run: yarn nx purge i18n-labels