-
-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (70 loc) · 2.26 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Release
on:
workflow_dispatch:
inputs:
upload_assets:
default: true
description: 'Upload assets to release'
type: boolean
jobs:
get_draft_release:
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.latest_draft_release.outputs.body }}
release_id: ${{ steps.latest_draft_release.outputs.id }}
release_tag: ${{ steps.latest_draft_release.outputs.tag_name }}
release_upload_url: ${{ steps.latest_draft_release.outputs.upload_url }}
steps:
- name: Get Draft Release
uses: cardinalby/git-get-release-action@v1
id: latest_draft_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
latest: true
upload_assets:
if: ${{ inputs.upload_assets }}
needs: get_draft_release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: Compile assets
run: npm run production
- name: Create zip
run: tar -czvf dist.tar.gz dist
- name: Upload zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.get_draft_release.outputs.release_upload_url }}
asset_path: ./dist.tar.gz
asset_name: dist.tar.gz
asset_content_type: application/tar+gz
release:
runs-on: ubuntu-latest
needs: get_draft_release
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Update Changelog
id: update_changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ needs.get_draft_release.outputs.release_tag }}
release-notes: ${{ needs.get_draft_release.outputs.release_body }}
- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.get_draft_release.outputs.release_id }}