-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (64 loc) · 2.37 KB
/
pack.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
on:
workflow_dispatch:
push:
branches: 'master'
jobs:
# Check if the branch's package.json version has a corrosponding git tag
# If it does exit with an error to stop compilation
checktag:
name: 'Check if version is not tagged'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout branch the workflow is being ran on
uses: 'actions/checkout@v2'
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Read package.json
id: package
uses: gregoranders/nodejs-project-info@v0.0.1
- name: 'Check: package version does not have corrosponding git tag'
id: version
shell: bash
run: git show-ref --tags --verify --quiet -- "refs/tags/v${{ steps.package.outputs.version }}" && exit 1 || echo "::set-output name=version::${{ steps.package.outputs.version }}"
pack:
name: 'Pack & Draft Release'
needs: [checktag]
runs-on: ubuntu-latest
outputs:
success: ${{ steps.finished.outputs.success }}
steps:
- name: Checkout branch the workflow is being ran on
uses: 'actions/checkout@v2'
- name: Setup Nodejs
uses: 'actions/setup-node@v2'
with:
node-version: '14.x'
- name: Install Project Dependencies
run: npm ci --quiet
- name: Zip files
uses: vimtor/action-zip@v1
with:
files: index.js process-message.js package.json node_modules/
recursive: false
dest: 3rd-party-chat.zip
- name: Draft Release
id: draft
uses: 'actions/create-release@v1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.checktag.outputs.version }}
release_name: 3rd Party Chat Listener v${{ needs.checktag.outputs.version }}
body: "##3rd Party Chat Listener v${{ needs.checktag.outputs.version }}\n\n"
draft: true
- name: Upload Zip
uses: 'actions/upload-release-asset@v1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft.outputs.upload_url }}
asset_path: './3rd-party-chat.zip'
asset_name: '3rd-Party-Chat-Listener-v${{ needs.checktag.outputs.version }}.zip'
asset_content_type: application/octet-stream