-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.14 KB
/
tag-release-publish.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
# GitHub Actions documentation:
# https://docs.github.com/en/actions
name: Create new tag, create new GitHub release and publish to NPM
on: workflow_dispatch
concurrency:
group: tag-release-publish-${{ github.ref }}
cancel-in-progress: true
jobs:
create_git_tag:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Create new tag
runs-on: ubuntu-latest
timeout-minutes: 20
outputs:
new_tag: ${{ steps.detect_then_tag.outputs.tag }}
new_version: ${{ steps.detect_then_tag.outputs.current-version }}
old_version: ${{ steps.detect_then_tag.outputs.previous-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Detect and tag new version
id: detect_then_tag
uses: salsify/action-detect-and-tag-new-version@v2
create_github_release:
if: ${{ needs.create_git_tag.outputs.new_tag }}
name: Create new GitHub release
needs: create_git_tag
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: ncipollo/release-action@v1
with:
body: "\
Changelog: \
${{ github.server_url }}/${{ github.repository }}\
/compare/\
v${{ needs.create_git_tag.outputs.old_version }}...v${{ needs.create_git_tag.outputs.new_version }}\
"
name: Release ${{ needs.create_git_tag.outputs.new_tag }}
tag: ${{ needs.create_git_tag.outputs.new_tag }}
publish_npm:
name: Publish to NPM
needs: create_github_release
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
registry-url: https://registry.npmjs.org
- name: Install Dependencies
run: yarn install --frozen-lockfile
working-directory: ember-slugify
- name: Publish to NPM
run: npm publish
working-directory: ember-slugify
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}