Merge pull request #24 from zeroedin/fix/update-console-0.2.3 #26
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| # Prevents changesets action from creating a PR on forks | |
| if: github.repository == 'zeroedin/z-changeset-practice' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: npm | |
| - uses: google/wireit@setup-github-actions-caching/v2 | |
| - run: npm ci --prefer-offline | |
| - run: npm run build | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: npx changeset publish | |
| commit: "chore: prepare release" | |
| title: "chore: prepare release" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create release branch | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| TAG_NAME="v$PACKAGE_VERSION" | |
| RELEASE_BRANCH="release/${TAG_NAME}" | |
| # Check if branch exists and delete it if it does | |
| if git show-ref --verify --quiet "refs/heads/$RELEASE_BRANCH"; then | |
| echo "Branch $RELEASE_BRANCH already exists, deleting it..." | |
| git branch -D "$RELEASE_BRANCH" | |
| fi | |
| # Check if remote branch exists and delete it if it does | |
| if git show-ref --verify --quiet "refs/remotes/origin/$RELEASE_BRANCH"; then | |
| echo "Remote branch $RELEASE_BRANCH already exists, deleting it..." | |
| git push origin --delete "$RELEASE_BRANCH" | |
| fi | |
| # Create and push new release branch | |
| git checkout -b "$RELEASE_BRANCH" | |
| git push origin "$RELEASE_BRANCH" | |
| echo "Created release branch: $RELEASE_BRANCH" |