-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (63 loc) · 2.25 KB
/
new-deploy.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
name: deploy
on:
release:
types: [ created ]
jobs:
deploy:
if: ${{ contains(github.ref, 'refs/tags/release-') }}
runs-on: ubuntu-latest
steps:
# GET TAG VERSION & RELEASE_VERSION IN $GITHUB_ENV
- name: Get TAG_VERSION & RELEASE_VERSION
run: |
echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/release-}" >> $GITHUB_ENV
# CHECKOUT REPOSITORY
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: main
# SETUP NODE ENV W/ NPM PUBLIC REGISTRY
- name: Setup Node Env
uses: actions/setup-node@v2
with:
registry-url: 'https://registry.npmjs.org'
# CONFIGURE GIT
- name: Configure Git
run: |
git config user.name github-ci
git config user.email [email protected]
# RUN SCRIPTS
- name: Update package version
run: node -e "let pkg=require('./package.json'); pkg.version='${{ env.RELEASE_VERSION }}'; require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));"
- name: Build Package
run: |
npm install
npm run build
# PUBLISH VUE PACKAGE
- name: Publish VueJS Package
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# ADD & COMMIT CHANGES
- name: Add & Commit Changes
run: |
git add .
git commit -am "[github-ci] Published Version"
git push origin main:npm --force
# TAG VERSION
- name: Tag Version
run: |
git tag -a ${{ env.TAG_VERSION }} -m ${{ env.TAG_VERSION }} --force
git push --tags --force
# SUCCESS MESSAGE TO DISCORD
- name: Success Message to Discord
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.WEBHOOK_URL }}
title: "Published @yoonit/rxjs-yoonit-store v${{ env.RELEASE_VERSION }}"
description: |
A new release has been published:
[Click here to go to the release page](https://github.com/Yoonit-Labs/rxjs-yoonit-store/releases/tag/${{ env.TAG_VERSION }})
color: 0x00ff00
username: GitHub Actions