-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (86 loc) · 3.17 KB
/
create-new-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
name: "Create new release"
on:
workflow_dispatch:
inputs:
version:
description: "Select the version increment"
required: true
type: choice
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
jobs:
create-new-release:
name: Create new release
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
- name: Setup Yarn
uses: volta-cli/action@v4
- name: Setup env
run: echo "FONTAWESOME_NPM_AUTH_TOKEN=${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}" > .env
- name: Bump version in package.json
run: yarn version ${{ github.event.inputs.version }}
- name: Extract version from package.json
id: extract_version
run: |
version=$(grep '"version"' package.json | sed -E 's/.*"version": "([^"]+)".*/\1/')
echo "Extracted version: $version"
echo "::set-output name=version::$version"
- name: Create version bump branch
run: git checkout -b release/v${{ steps.extract_version.outputs.version }}
- name: Initialize mandatory git config
uses: fregante/setup-git-user@v2
- name: Commit manifest files
id: make-commit
run: |
git add package.json
git commit --message "Update package.json v${{ steps.extract_version.outputs.version }}"
echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Publish release branch
run: git push origin release/v${{ steps.extract_version.outputs.version }}
- name: Merge version update into main branch
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: release/v${{ steps.extract_version.outputs.version }}
base: main
title: "Merge release/v${{ steps.extract_version.outputs.version }} into main branch"
- name: Install dependencies
run: yarn install
# Build assets
- run: yarn build
- run: npm pack
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.extract_version.outputs.version }}
release_name: Release v${{ steps.extract_version.outputs.version }}
body_path:
draft: false
prerelease: false
# Upload assets to the release
- name: Upload Release Asset
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: ./user-interviews-ui-design-system-${{ steps.extract_version.outputs.version }}.tgz
asset_name: user-interviews-ui-design-system-${{ steps.extract_version.outputs.version }}.tgz
asset_content_type: application/tar+gzip