-
Notifications
You must be signed in to change notification settings - Fork 97
78 lines (65 loc) · 2.29 KB
/
release_and_publish.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
name: Release and publish
run-name: Release and publish ${{ github.event.release.tag_name }}
on:
release:
types: [published]
permissions:
contents: write
concurrency: ${{ github.workflow }}
env:
TAG_NAME: ${{ github.event.release.tag_name }}
USERSCRIPT_FILE_PATH: dist/Simple-YouTube-Age-Restriction-Bypass.user.js
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Update package version
run: |
npm version "$TAG_NAME" --allow-same-version --git-tag-version false
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Upload assets to GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.USERSCRIPT_FILE_PATH }}
dist/**/*.zip
- name: Commit changes
# Prevent running this in forks and also if this is a prerelease
if: github.event.repository.fork == false && github.event.release.prerelease == false
env:
COMMIT_USER_NAME: github-actions[bot]
COMMIT_USER_EMAIL: github-actions[bot]@users.noreply.github.com
COMMIT_AUTHOR: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
COMMIT_MESSAGE: Release ${{ env.TAG_NAME }}
COMMIT_FILES: |
${{ env.USERSCRIPT_FILE_PATH }}
*.json
run: |
git config user.name "$COMMIT_USER_NAME"
git config user.email "$COMMIT_USER_EMAIL"
git add -f $(echo "$COMMIT_FILES")
git commit -m "$COMMIT_MESSAGE" --author="$COMMIT_AUTHOR"
git push origin
# Update tag
git tag -f "$TAG_NAME"
git push -f origin "$TAG_NAME"
publish:
name: Publish to GreasyFork
needs: release
# Prevent running this in forks and also if this is a prerelease
if: github.event.repository.fork == false && github.event.release.prerelease == false
uses: ./.github/workflows/publish_to_greasyfork.yml
secrets: inherit