-
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (123 loc) · 4.92 KB
/
prepare-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
140
141
142
143
144
145
146
147
148
149
name: Prepare Release
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
env:
NODE_VERSION: "18.x"
permissions: write-all
jobs:
prepare-artifacts:
name: Prepare Artifacts
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_APP_URL: ${{ vars.NEXT_PUBLIC_APP_URL }}
PRE_RELEASE_TAG: ${{ vars.PRE_RELEASE_TAG }}
AUTOMATION_USER_NAME: ${{ vars.AUTOMATION_USER_NAME }}
AUTOMATION_USER_EMAIL: ${{ vars.AUTOMATION_USER_EMAIL }}
SKIP_IGNITION_BUILD: true
outputs:
tag-name: ${{ steps.prepare-release.outputs.TAG_NAME }}
dependency-hash: ${{ steps.extract-dependencies.outputs.DEPENDENCY_HASH }}
rocketicons-tgz: ${{ steps.generated-pkg-name.outputs.PKG_FILE }}
rocketicons-artifact-id: ${{ contains(steps.prepare-release.outputs.TAG_NAME, 'release') == true && 'deployable-artifacts' || 'rocketicons-pkg' }}
vercel-url-alias: ${{ steps.branch-to-url.outputs.URL_ID }}${{ vars.VERCEL_ALIAS_DOMAIN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Extract Dependencies
id: extract-dependencies
run: echo "DEPENDENCY_HASH=$(npx --yes @rocketclimb/sh extract-dependencies)" >> $GITHUB_OUTPUT
- name: Cache node_modules
uses: actions/cache@v4
id: npm-cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ steps.extract-dependencies.outputs.DEPENDENCY_HASH }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache icons
uses: actions/cache@v4
id: icons-cache
with:
path: |
packages/generator/icons
key: ${{ runner.os }}-icons-${{ hashFiles('packages/generator/src/definitions.ts') }}
restore-keys: |
${{ runner.os }}-icons-
- name: Install packages
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm install --ignore-scripts
- name: Icons Fetch
if: steps.icons-cache.outputs.cache-hit != 'true'
run: npm run fetch --workspace=packages/generator
- name: Build All
run: npm run build-all
- name: Run tests
run: npm run test-all
- name: Build Ignition statics
run: npm run generate-statics:all-icons --workspace=packages/ignition
- name: Setup git user
run: |
git config user.name ${{ env.AUTOMATION_USER_NAME }}
git config user.email ${{ env.AUTOMATION_USER_EMAIL }}
- name: Prepare tag or release
id: prepare-release
run: |
echo "TAG_NAME=$(npm run release | grep v)" >> $GITHUB_OUTPUT
- name: Set output as environment variable
run: echo "TAG_NAME=${{ steps.prepare-release.outputs.TAG_NAME }}" >> $GITHUB_ENV
- name: Branch Name to Url
id: branch-to-url
run: |
echo "URL_ID=$(echo "${{ github.head_ref }}" | tr -s ' ' | tr '[:upper:]' '[:lower:]' | sed 's,[ /],-,g')" >> $GITHUB_OUTPUT
- name: Get genereated package name
id: generated-pkg-name
run: echo "PKG_FILE=$(ls -1 -t *.tgz | head -1)" >> $GITHUB_OUTPUT
- name: Generate artifact for tag ${{ steps.prepare-release.outputs.TAG_NAME }}
run: |
echo "${{ steps.prepare-release.outputs.TAG_NAME }}" >> .tagrc
- name: Upload tag artifact to release job
uses: actions/upload-artifact@v4
with:
name: tag-artifact
path: .tagrc
- name: Upload deployable artifacts to release job
if: contains(steps.prepare-release.outputs.TAG_NAME, 'release')
uses: actions/upload-artifact@v4
with:
name: deployable-artifacts
path: |
release-notes.md
${{ steps.generated-pkg-name.outputs.PKG_FILE }}
- name: Upload rocketicons tgz as artifact
if: contains(steps.prepare-release.outputs.TAG_NAME, 'release') == false
uses: actions/upload-artifact@v4
with:
name: rocketicons-pkg
path: ${{ steps.generated-pkg-name.outputs.PKG_FILE }}
- name: Upload data-helpers
uses: actions/upload-artifact@v4
with:
name: data-helpers
path: packages/ignition/src/app/data-helpers
publish-ignition:
needs: prepare-artifacts
uses: ./.github/workflows/publish-ignition.yml
with:
dependencies-hash: ${{ needs.prepare-artifacts.outputs.dependency-hash }}
rocketicons-tgz: ${{ needs.prepare-artifacts.outputs.rocketicons-tgz }}
rocketicons-artifact-id: ${{ needs.prepare-artifacts.outputs.rocketicons-artifact-id }}
vercel-url-alias: ${{ needs.prepare-artifacts.outputs.vercel-url-alias }}
branch: ${{ github.head_ref }}
secrets:
token: ${{ secrets.VERCEL_TOKEN }}