mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-16 08:52:35 +00:00
* feat(ci): allow auto release * chore(ci): simplify release * chore: apply suggestions from code review
65 lines
2.3 KiB
YAML
65 lines
2.3 KiB
YAML
name: Release
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
startsWith(github.event.commits[0].message, 'fix(deps): update renovate/renovate docker tag ')
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2.1.0
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Fetch tags
|
|
run: git fetch --tags
|
|
- name: Setup Git user
|
|
run: |
|
|
git config --local user.name "github-actions[bot]"
|
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
- name: Setup node
|
|
uses: actions/setup-node@v1.4.1
|
|
with:
|
|
node-version: '12.x'
|
|
- name: Install project
|
|
run: npm ci
|
|
- name: Release
|
|
run: |
|
|
SEMVER_REGEX="v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)"
|
|
if [[ ! "${{ github.event.commits[0].message }}" =~ ${SEMVER_REGEX} ]]; then
|
|
echo Not a semver like version - aborting: ${1}
|
|
exit 1
|
|
fi
|
|
NEXT_VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
|
|
MAJOR_VERSION="${BASH_REMATCH[1]}"
|
|
echo "::set-env name=NEXT_VERSION::${NEXT_VERSION}"
|
|
echo "::set-env name=MAJOR_VERSION::${MAJOR_VERSION}"
|
|
npm version ${NEXT_VERSION} -m "chore(release): ${NEXT_VERSION}"
|
|
git tag "v${MAJOR_VERSION}"
|
|
|
|
- name: Publish release
|
|
run: |
|
|
git push origin "v${NEXT_VERSION}"
|
|
git push -f origin "v${MAJOR_VERSION}"
|
|
|
|
# - name: Publish GitHub release
|
|
# uses: actions/create-release@v1.0.1
|
|
# env:
|
|
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
# with:
|
|
# tag_name: v${{ env.NEXT_VERSION }}
|
|
# release_name: v${{ env.NEXT_VERSION }}
|
|
# body: |
|
|
# See the the [changelog](
|
|
# https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md
|
|
# ) for the changes included in this release.
|
|
prevent_failed_status:
|
|
name: Prevent failed status when skipped
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Prevent failed status when skipped
|
|
run: |
|
|
echo "Run this job to prevent the workflow status from showing as" \
|
|
"failed when all other jobs are skipped."
|