This repository has been archived by the owner on Feb 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (123 loc) · 5.3 KB
/
publish_pre_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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Publish Pre-release
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
bumprelease:
type: choice
description: Bump a package version
required: true
default: prerelease
options:
- prerelease
- prepatch
- preminor
- premajor
env:
bumprelease: ${{ github.event.inputs.bumprelease || 'prerelease' }}
NPM_USER: ${{ secrets.NPM_USER }}
NPM_PASS: ${{ secrets.NPM_PASS }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
has_new_commits: ${{ steps.has_new_commits.outputs.has_new_commits }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check for commits within time
uses: AlexHolderDeveloper/[email protected]
id: commitswithintime
with:
hours: 24
includeGithubActor: false
emailAddressesToIgnore: '{"ignoredEmailAddressesList": ["[email protected]"]}'
- name: Get the output from CommitsWithinTime
run: |
echo "The 'has-new-commits-within-time' value is ${{ steps.commitswithintime.outputs.has-new-commits-within-time }}"
echo "The 'number-of-commits-within-time' value is ${{ steps.commitswithintime.outputs.number-of-commits-within-time }}"
echo "The 'total-commits' value is ${{ steps.commitswithintime.outputs.total-commits }}"
- id: has_new_commits
name: Check latest commit in 24 hrs ago
if: ${{ (steps.commitswithintime.outputs.has-new-commits-within-time) && (github.event_name == 'schedule') }}
run: echo "::set-output name=has_new_commits::true"
main:
needs: check_date
if: ${{ needs.check_date.outputs.has_new_commits }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Login to GitHub Private NPM Registry
shell: bash
run: |
npm install -g npm-cli-login
npm-cli-login -u $NPM_USER -p $NPM_PASS -e "$NPM_EMAIL" -r "https://npm.pkg.github.com" -s "@betterdiscordbuilder"
- name: Bump a package version
if: ${{ 'refs/heads/main' == github.ref }}
id: bump_version
run: |
npm install -g version-bump-prompt
bump $bumprelease ./pre-release/package.json
- name: Install Dependencies
run: npm install
- name: Run script
if: steps.bump_version.outcome == 'success'
id: build_prerelease
run: npm run script:publish_prerelease
- uses: nyaa8/package-version@v1
if: steps.build_prerelease.outcome == 'success'
id: package_version
with:
path: "./pre-release/package.json"
follow-symlinks: "false"
# - name: Create Release
# if: steps.package_version.outcome == 'success'
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: v${{ env.PACKAGE_VERSION }}
# release_name: ${{ env.PACKAGE_VERSION }}
# body: "##### ${{ env.bumprelease }}"
# draft: false
# prerelease: true
# - name: Upload Release Asset
# if: steps.create_release.outcome == 'success'
# id: 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: ./pre-release/RPCPcStatus.plugin.js
# asset_name: RPCPcStatus.plugin.js
# asset_content_type: text/javascript
- name: Automatically Commit Changed
if: steps.package_version.outcome == 'success'
id: commit_changed
uses: stefanzweifel/git-auto-commit-action@v4
with:
push_options: "--force"
commit_options: "--no-verify"
commit_message: "New Pre release ${{ env.PACKAGE_VERSION }}"
commit_user_name: GitHub Actions
commit_user_email: [email protected]
commit_author: GitHub Actions <[email protected]>
tagging_message: v${{ env.PACKAGE_VERSION }}
skip_checkout: true
# - name: Create tag
# if: steps.commit_changed.outcome == 'success'
# uses: rickstaa/action-create-tag@v1
# with:
# tag: v${{ env.PACKAGE_VERSION }}