-
Notifications
You must be signed in to change notification settings - Fork 11
88 lines (78 loc) · 2.63 KB
/
_pm_push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: PM / Push
on:
push:
branches: [master, trunk, main]
workflow_dispatch:
repository_dispatch:
types:
- trigger:release
jobs:
release-drafter:
name: Draft Release
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
steps:
- name: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PROTECTED_PUSH_TOKEN }}
fetch-depth: 0
- name: setup node.js
uses: actions/setup-node@v3
with:
node-version: 14
- name: setup git
run: |
git config user.name "release-action"
git config user.email "[email protected]"
- name: install auto
run: |
npm install auto --global
- name: get auto version
id: auto
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp ./.github/auto.json ./.autorc.json
latest_semver_sha=$(git rev-list --tags="v[0-9]*.[0-9]*.[0-9]*" --max-count=1)
version=$(auto version --from $latest_semver_sha)
rm ./.autorc.json
echo "::set-output name=version::$version"
- name: setup pnpm
if: steps.auto.outputs.version != ''
uses: pnpm/[email protected]
with:
version: 7.18.1
- name: bump version and push
id: bump
if: steps.auto.outputs.version != ''
run: |
git pull --ff-only
npm version $BUMP -m "Bump version to: %s [skip ci]"
git push origin --follow-tags
env:
BUMP: ${{ steps.auto.outputs.version }}
- name: get latest tag
id: tag
continue-on-error: true
run: |
latest_semver_sha=$(git rev-list --tags="v[0-9]*.[0-9]*.[0-9]*" --max-count=1)
if [[ "$latest_semver_sha" != "" ]]; then \
latest_tag=$(git describe --tags $latest_semver_sha); \
echo "::set-output name=latest_semver_sha::$latest_semver_sha"; \
echo "::set-output name=latest_tag::$latest_tag"; \
echo "::set-output name=latest_version::${latest_tag//v/}"; \
fi
- name: updating draft release
if: ${{ steps.tag.outputs.latest_tag }}
id: release
uses: release-drafter/release-drafter@v5
with:
name: ${{ steps.tag.outputs.latest_tag }}
version: ${{ steps.tag.outputs.latest_version }}
# commitish: ${{ steps.tag.outputs.latest_semver_sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}