-
Notifications
You must be signed in to change notification settings - Fork 5
77 lines (61 loc) · 1.75 KB
/
publish-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
74
75
76
77
name: Publish Release
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
issues: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build project
run: |
npm ci
npm run build
- name: Zip bundle
run: |
zip -r ./${{ github.sha }}.zip .
- name: Archive artifact
uses: actions/upload-artifact@v3
with:
name: zipped-bundle
path: ${{ github.sha }}.zip
publish:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Get version from package.json
id: get_version
run: |
VERSION=$(jq -r .version < package.json)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: New release for commit ${{ github.sha }}.
draft: true
prerelease: true
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: zipped-bundle
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ github.sha }}.zip
asset_name: source_code_with_libraries.zip
asset_content_type: application/zip