Skip to content

new branch 2.5.3

new branch 2.5.3 #299

name: Publish to themes target tag based off of themes branch name
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]+
# arc-themes-release-version-{numbers}.{numbers}.{numbers} per product
- arc-themes-release-version-[0-9]+\.[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
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
registry-url: "https://npm.pkg.github.com"
- name: Cache Node 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"
# GITHUB_ACTOR is the username of the user that initiated the workflow run
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
# need this config for running `npm version {version level}` commit
# Prerelease (tests and lint)
- 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 }}
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()