-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (85 loc) · 2.63 KB
/
standard-publish.yaml
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
name: Standard Publish
permissions: write-all
on:
workflow_dispatch:
inputs:
version:
description: 'Select Version To Bump'
required: true
type: choice
options:
- patch
- minor
- major
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checkout repo
- name: Checkout Repo
id: checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.PUBLISHER_SSH_KEY }}
# Install nix
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
# Prepare and build sushi lib
- name: Build Sushi Lib
id: sushi
if: steps.checkout.outcome == 'success'
run: ./prep-sushi.sh
# Install node
- name: Install NodeJS v18
id: node
if: steps.sushi.outcome == 'success'
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
# Install deps
- name: Install Dependencies
id: install
if: steps.node.outcome == 'success'
run: npm install
# Configure Git
- name: Git Config
id: git
if: steps.install.outcome == 'success'
run: |
git config --global user.email "${{ secrets.CI_GIT_EMAIL }}"
git config --global user.name "${{ secrets.CI_GIT_USER }}"
# Set Release Version
- name: Bump Version
id: version
if: steps.git.outcome == 'success'
# bump the version without creating tag/commit and store the version in env
run: echo "NEW_VERSION=$(npm version ${{ inputs.version }} --no-git-tag-version)" >> $GITHUB_ENV
# Commit changes and tag
- name: Commit And Tag
id: commit
if: steps.version.outcome == 'success'
run: |
git add "package.json"
git add "package-lock.json"
git commit -m "Release ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
# Push changes and tag
- name: Push Changes To Remote
id: push
if: steps.commit.outcome == 'success'
run: |
git push origin
git push -u origin ${{ env.NEW_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create gitHub release with built package archives
- name: Create GitHub Release
id: release
if: steps.push.outcome == 'success'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.NEW_VERSION }}
name: Release ${{ env.NEW_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}