Skip to content

Production release v0.2.4 #2199

Production release v0.2.4

Production release v0.2.4 #2199

Workflow file for this run

name: Publish
defaults:
run:
shell: bash
working-directory: ./packages/core
on:
pull_request:
types: [closed]
branches:
- release
jobs:
publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
pull-requests: write
actions: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Check the condition
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'release'
run: exit 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
- uses: pnpm/action-setup@v2
with:
version: 8
- name: git config
run: |
git config --global user.name "sheincbot[bot]"
git config --global user.email "${{ secrets.APP_ID }}+sheincbot[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/${{ github.repository }}.git
- name: Package install
run: pnpm install --frozen-lockfile
- name: Update version
run: pnpm version patch --no-git-tag-version
- name: Get version
id: get_version
run: |
CURRENT_VERSION=$(node -e "console.log(require('./package.json').version)")
echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
- name: Commit version
run: |
git switch release
git add .
git commit -m "chore: update version"
git tag v${{ steps.get_version.outputs.version }}
git push origin release --tags
- name: Publish package
run: pnpm run -w release
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_GITHUB_TOKEN }}
- name: Create release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: "v${{ steps.get_version.outputs.version }}"
with:
tag: ${{ env.RELEASE_TAG }}
name: Release ${{ env.RELEASE_TAG }}
version: ${{ env.RELEASE_TAG }}
publish: true