Skip to content

CDS Tag Publish feature/ADCIO-4573 #28

CDS Tag Publish feature/ADCIO-4573

CDS Tag Publish feature/ADCIO-4573 #28

name: CDS Tag Publish
run-name: CDS Tag Publish ${{ github.ref_name }}
on:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '18'
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/cache@v3
id: pnpm-cache
with:
path: node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- if: steps.pnpm-cache.outputs.cache-hit != 'true'
run: pnpm install --no-frozen-lockfile
- run: pnpm run build
- name: Get SLUG and SHA
id: tag-meta
run: |
BRANCH_SLUG=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/\//-/g')
TIME=$(date +%s)
echo "BRANCH_SLUG=${BRANCH_SLUG}" >> "$GITHUB_OUTPUT"
echo "TIME=${TIME}" >> "$GITHUB_OUTPUT"
- name: Publish Dev Tag
env:
TAG_NAME: ${{ steps.tag-meta.outputs.BRANCH_SLUG }}-${{ steps.tag-meta.outputs.TIME }}
run: |
rm -rf src .husky .github .storybook .prettierrc .eslint.config.js pnpm-lock.yaml vercel.json vite.config.js tsconfig.json tsconfig.build.json tsconfig.node.json
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
CURRENT_VERSION=$(pnpm pkg get version | tr -d '"')
pnpm version $CURRENT_VERSION-$TAG_NAME --no-git-tag-version
git add .
git add -f dist
git commit -m "chore: release v$CURRENT_VERSION-$TAG_NAME"
git tag -a v$CURRENT_VERSION-$TAG_NAME -m "Release v$CURRENT_VERSION-$TAG_NAME"
git push --tag