fix: Update install script #6
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
name: Release | |
on: | |
push: | |
branches: [master] | |
permissions: | |
contents: write | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
env: | |
GIT_AUTHOR_NAME: github-actions[bot] | |
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
GIT_COMMITTER_NAME: github-actions[bot] | |
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21 | |
- name: Release semantic version | |
run: | | |
npm i -g semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/exec | |
npx semantic-release | |
- name: Release major version | |
run: | | |
VERSION="$(git tag --points-at ${{ github.sha }})" | |
if [ -z $VERSION ]; then | |
echo "No major version to publish" >> $GITHUB_STEP_SUMMARY | |
else | |
MAJOR_VERSION="$(cut -d '.' -f 1 <<< "$VERSION")" | |
git config user.name "${GIT_AUTHOR_NAME}" | |
git config user.email "${GIT_AUTHOR_EMAIL}" | |
git tag -fa ${MAJOR_VERSION} -m "Map ${MAJOR_VERSION} to ${VERSION}" | |
git push origin ${MAJOR_VERSION} --force | |
echo "Successfully published semantic version \`$VERSION\` and major version \`$MAJOR_VERSION\`" >> $GITHUB_STEP_SUMMARY | |
fi | |
notify: | |
needs: [release] | |
name: Notify | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- uses: andrewscwei/telegram-action@v1 | |
with: | |
success: ${{ needs.release.result == 'success' }} | |
cancelled: ${{ needs.release.result == 'cancelled' }} | |
bot-token: ${{ secrets.TELEGRAM_DEVOPS_BOT_TOKEN }} | |
chat-id: ${{ secrets.TELEGRAM_DEVOPS_CHAT_ID }} |