-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.5 KB
/
release.yaml
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
name: Release
on:
# Allows to trigger workflow manually
workflow_dispatch:
jobs:
ensure_version_changed:
name: Ensure that version was changed
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if version was changed
id: check_version
run: |
NEW_PACKAGE_VERSION=$(node -pe 'require("./package.json").version')
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $latestTag
OLD_PACKAGE_VERSION=$(node -pe 'require("./package.json").version')
if [ $NEW_PACKAGE_VERSION != $OLD_PACKAGE_VERSION ]; then
echo "::set-output name=version::$NEW_PACKAGE_VERSION"
fi
build:
needs: [ensure_version_changed]
if: ${{ needs.ensure_version_changed.outputs.version }}
uses: ./.github/workflows/build.yaml
secrets: inherit
with:
should_pack: true
publish:
runs-on: ubuntu-latest
needs: [build, ensure_version_changed]
if: ${{ needs.ensure_version_changed.outputs.version }}
name: Publish to npm
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ukorvl-react-on-screen-${{ needs.ensure_version_changed.outputs.version }}
- name: Publish
run: |
npm config set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_PUBLISH_TOKEN }}
npm publish --access public ukorvl-react-on-screen-${{ needs.ensure_version_changed.outputs.version }}.tgz
tag:
runs-on: ubuntu-latest
needs: [build, ensure_version_changed, publish, release]
if: ${{ needs.ensure_version_changed.outputs.version }}
name: Tag
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Tag new version
run: git tag v${{ needs.ensure_version_changed.outputs.version }}
- name: Push tags
uses: ad-m/github-push-action@master
with:
tags: true
release:
runs-on: ubuntu-latest
needs: [build, ensure_version_changed, publish]
if: ${{ needs.ensure_version_changed.outputs.version }}
name: Create release
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
tag: v${{ needs.ensure_version_changed.outputs.version }}
name: Release ${{ needs.ensure_version_changed.outputs.version }}