-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (56 loc) · 1.74 KB
/
release.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
name: Release
on:
push:
branches:
- master
workflow_dispatch:
jobs:
draft_release:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.release-drafter.outputs.tag_name }}
steps:
# Get next version
- uses: release-drafter/release-drafter@v5
id: release-drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
environment:
name: prod
url: https://www.npmjs.com/package/junit2json
needs: draft_release
if: github.event_name == 'workflow_dispatch'
steps:
# Create version string from tag (v1.0.0 -> 1.0.0)
- name: Create version string
run: |
export TAG_NAME=${{ needs.draft_release.outputs.tag_name }}
echo "VERSION=${TAG_NAME:1}" >> $GITHUB_ENV
- uses: earthly/actions-setup@v1.0.8
with:
version: latest
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
ref: master
# Use GitHub App for bypassing ruleset guard when git push by npm publish
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BYPASS_APP_ID }}
private-key: ${{ secrets.BYPASS_APP_PRIVATE_KEY }}
# npm publish and push updated package.json
- name: Publish
run: |
npm run release -- --VERSION=$VERSION
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
# Publish github releases. Also tag will be created.
- uses: release-drafter/release-drafter@v5
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}