Update .nvmrc #84
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: Themes version sync branch build with canary | |
on: | |
push: | |
branches: | |
# only run on branch names that match: | |
# arc-themes-release-version-{numbers}.{numbers} per product | |
- arc-themes-release-version-[0-9]+\.[0-9]+ | |
jobs: | |
publish: | |
name: Branch build publish | |
runs-on: ubuntu-latest | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.THEMES_OPS_SLACK_WEBHOOK_URL }} | |
SYNCED_RELEASE_TAG: ${{ github.ref_name }} # targets branch name ref_name | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
# Sets up Node v12 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
registry-url: "https://npm.pkg.github.com" | |
- name: Cache NPM files | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- name: Clean install (CI) dependencies if lockfile (above) changed | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Format branch name . to - for preid version compatibility | |
id: format_branch_step | |
run: | | |
new_branch_name="${SYNCED_RELEASE_TAG//./-}" | |
echo $new_branch_name | |
echo "::set-output name=formatted_branch_name::$new_branch_name" | |
- name: Version with preid for branch name | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "$GITHUB_ACTOR" | |
npm version prerelease --preid=${{ steps.format_branch_step.outputs.formatted_branch_name }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Publish to branch name | |
- run: npm publish --tag ${{ env.SYNCED_RELEASE_TAG }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Push tag | |
- run: git push origin ${{ env.SYNCED_RELEASE_TAG }} -f | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check failure status and post in themes ops channel | |
uses: act10ns/slack@v1 | |
with: | |
status: ${{ job.status }} | |
if: failure() | |
tag_canary_if_1x: | |
runs-on: ubuntu-latest | |
# has to run publish job first successfully | |
needs: publish | |
# checks for presence of "-1." in branch name already matching criteria arc-themes-release-version-[0-9]+\.[0-9]+ | |
# contains('Hello', 'ello') -> returns true docs https://docs.github.com/en/actions/learn-github-actions/expressions#contains | |
if: contains(github.ref_name, '-1.') | |
env: | |
SYNCED_RELEASE_TAG: ${{ github.ref_name }} # targets branch name ref_name | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Setup Node and NPM | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "12" | |
registry-url: "https://npm.pkg.github.com" | |
- name: Tag 1.x release with canary | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "$GITHUB_ACTOR" | |
npm dist-tag add @wpmedia/engine-theme-sdk@$(npm view @wpmedia/engine-theme-sdk@${{ env.SYNCED_RELEASE_TAG }} version) canary | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |