-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(release): update the release workflows
- Loading branch information
1 parent
855acde
commit c8726e3
Showing
3 changed files
with
165 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
name: Release Updated GitHub Action | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
release: | ||
if: (!contains(github.event.head_commit.message, 'build(release)') && !contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')) | ||
name: Release GitHub Actions | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
contents: write | ||
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.RELEASE_TOKEN }} | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
always-auth: true | ||
cache: npm | ||
|
||
- name: Configure PATH | ||
run: | | ||
mkdir -p "$HOME/.local/bin" | ||
echo "$HOME/.local/bin" >> "${GITHUB_PATH}" | ||
echo "HOME=$HOME" >> "${GITHUB_ENV}" | ||
- uses: actions/cache@v3 | ||
if: always() | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: | | ||
.yarn/cache | ||
node_modules | ||
${{env.HOME}}/.cache | ||
${{env.HOME}}/.local | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{hashFiles('.github/workflows/release_action.yml')}} | ||
restore-keys: | | ||
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{hashFiles('.github/workflows/release_action.yml')}} | ||
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}- | ||
${{ runner.os }}-yarn- | ||
- name: Configure Git | ||
run: | | ||
git config --global user.email "${{github.event.pusher.email || '[email protected]'}}" | ||
git config --global user.name "${{github.event.pusher.name || 'GitHub[bot]'}}" | ||
git fetch --tags | ||
git status --porcelain -u | ||
- name: Release It | ||
run: | | ||
set -e | ||
npx auto release -vv | ||
stub_major="${GITHUB_TAG%%\.*}" | ||
stub_major_minor="${GITHUB_TAG%\.*}" | ||
git tag -d "${stub_major}" 2>/dev/null || true | ||
git tag -d "${stub_major_minor}" 2>/dev/null || true | ||
git tag -a "${stub_major}" -m "Release ${newtag}" | ||
git tag -a "${stub_major_minor}" -m "Release ${newtag}" | ||
git push -f --follow-tags --set-upstream origin $branch | ||
git push -f --tags origin | ||
# - name: Bump Package Version | ||
# if: github.event_name == 'push' && steps.next_version.outputs.new_version != '' | ||
# id: bump-yarn | ||
# env: | ||
# newtag: '${{ steps.next_version.outputs.new_version }}' | ||
# run: | | ||
# yarntag="$(jq -r '.version' package.json)" | ||
# if [[ ${yarntag#v} != "${newtag#v}" ]]; then | ||
# yarn version -i "${newtag#v}" || true | ||
# yarn generate-docs | ||
# yarn "lint:markdown:fix" | ||
# yarn "lint:fix" | ||
# yarn auto changelog \ | ||
# --email "${{github.event.pusher.email}}" \ | ||
# --name "${{github.event.pusher.name}}" \ | ||
# --baseBranch "${{ github.event.pull_request.base.ref || github.ref }}" \ | ||
# --prerelease | ||
# git add . | ||
# git commit -m "build(release): v${newtag#v}" --no-verify | ||
# git push origin main || true | ||
# fi | ||
# echo ::set-output name=sha::$(git rev-parse HEAD) | ||
|
||
# - name: Create Release Branch | ||
# if: github.event_name == 'push' | ||
# id: release-branch | ||
# env: | ||
# newtag: '${{ steps.next_version.outputs.version }}' | ||
# run: | | ||
# git switch -C gh-action --no-guess ${{ steps.bump-yarn.outputs.sha }} | ||
# rm -rf __tests__ src node_modules .github | ||
# rm -rf .husky .trunk .vscode .cspell.json | ||
# rm -rf ./eslint* ./prettier* ./.lint* ./.markdown* | ||
# rm -rf junit.xml README.example.md ./.tsconfig.json | ||
# git add . | ||
# git add -f dist | ||
# git commit -m "build(release): v${newtag#v}" | ||
# git push origin gh-action -u --force | ||
# npx auto shipit --base-branch gh-actions -m 'docs: Update CHANGELOG.md [skip ci]' --name "${{github.event.pusher.name}}" --email "${{github.event.pusher.email}}" | ||
# echo ::set-output name=sha::$(git rev-parse HEAD) | ||
# - name: Bump version and push tag | ||
# if: steps.bump.outputs.bump != '' | ||
# id: tag_version | ||
# uses: mathieudutour/[email protected] | ||
# with: | ||
# commit_sha: ${{ steps.release-branch.outputs.sha }} | ||
# custom_tag: '${{ steps.next_version.outputs.new_version }}' | ||
# github_token: ${{ secrets.RELEASE_TOKEN }} | ||
# - name: Create a GitHub release | ||
# if: steps.bump.outputs.bump != '' | ||
# uses: ncipollo/release-action@v1 | ||
# with: | ||
# tag: ${{ steps.tag_version.outputs.new_tag }} | ||
# name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
# body: ${{ steps.tag_version.outputs.changelog }} | ||
# artifacts: dist/index.cjs | ||
# generateReleaseNotes: true | ||
# token: ${{ secrets.RELEASE_TOKEN }} | ||
# - name: Publish to NPM | ||
# if: steps.bump.outputs.bump != '' | ||
# run: | | ||
# npm publish --no-package-lock --prefer-offline --no-audit --no-progress --no-bin-links --ignore-scripts --ignore-engines --ignore-platform | ||
# - name: Update Label Tags | ||
# if: steps.bump.outputs.bump != '' | ||
# env: | ||
# newtag: ${{ steps.tag_version.outputs.new_version }} | ||
# run: | | ||
# git fetch --tags | ||
# stub_major="${newtag%%\.*}" | ||
# stub_major_minor="${newtag%\.*}" | ||
# git tag -f v${stub_major} | ||
# git push -f origin v${stub_major} | ||
# git tag v${stub_major_minor} | ||
# git push -f origin v${stub_major_minor} |
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
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