This repository was archived by the owner on Apr 8, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
175 lines (150 loc) · 6.12 KB
/
pack.yml
File metadata and controls
175 lines (150 loc) · 6.12 KB
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Pack fluence-cli
on:
workflow_call:
inputs:
ref:
description: "Git ref to checkout to"
type: string
default: "main"
tag:
description: "Release tag to upload artifacts to"
type: string
default: "null"
platform:
description: "Platform for which to build fluence-cli"
type: string
required: true
upload-to-s3:
description: "Upload artifact to s3"
type: boolean
default: false
channel:
description: "Promote version to channel"
type: string
default: "null"
node-version:
description: "Node version"
type: string
default: "22.10.0"
env:
CI: true
FORCE_COLOR: true
AWS_REGION: "eu-west-1"
AWS_S3_FORCE_PATH_STYLE: true
jobs:
pack:
name: "Pack fluence-cli"
runs-on: builder
permissions:
contents: write
id-token: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- name: Checkout fluence-cli
uses: actions/checkout@v4
with:
repository: fluencelabs/cli
ref: ${{ inputs.ref }}
- name: Import secrets
uses: hashicorp/vault-action@v3.0.0
id: secrets
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
kv/ci/fcli-binaries id | AWS_ACCESS_KEY_ID ;
kv/ci/fcli-binaries secret | AWS_SECRET_ACCESS_KEY ;
kv/docker-registry/basicauth/ci username | DOCKER_USERNAME ;
kv/docker-registry/basicauth/ci password | DOCKER_PASSWORD ;
- name: Login to private docker registry
uses: docker/login-action@v3
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
registry-url: "https://npm.fluence.dev"
cache: "yarn"
- run: yarn install
- name: Generate snapshot version
if: inputs.upload-to-s3 != true
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Cache node binaries
id: cache-node-binaries
uses: actions/cache@v4
env:
cache-name: cache-node-binaries
with:
path: packages/cli/package/tmp/cache/node-v${{ inputs.node-version }}-${{ inputs.platform }}
key: ${{ env.cache-name }}-${{ inputs.node-version }}-${{ inputs.platform }}
- name: Pack fluence-cli
run: yarn pack-${{ inputs.platform }}
- name: Upload fluence-cli
if: inputs.upload-to-s3 == true
working-directory: packages/cli/package
run: yarn upload-${{ inputs.platform }}
- name: Promote fluence-cli
if: inputs.channel != 'null' && inputs.platform != 'win32-x64'
working-directory: packages/cli/package
run: yarn oclif promote -t ${{ inputs.platform }} --version "$(jq .[] -r ../../../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel ${{ inputs.channel }} --no-xz --indexes
- name: Promote fluence-cli windows
if: inputs.channel != 'null' && inputs.platform == 'win32-x64'
working-directory: packages/cli/package
run: yarn oclif promote -t ${{ inputs.platform }} --version "$(jq .[] -r ../../../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel ${{ inputs.channel }} --no-xz --win --indexes
- name: Rename archive
if: inputs.platform != 'win32-x64'
run: mv packages/cli/package/dist/fluence-*${{ inputs.platform }}*.tar.gz fluence-cli-${{ inputs.platform }}.tar.gz
- name: Upload archive to CI
if: inputs.platform != 'win32-x64'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.platform }}
path: fluence-cli-${{ inputs.platform }}.tar.gz
- name: Upload archive to release
if: inputs.tag != 'null' && inputs.platform != 'win32-x64'
uses: softprops/action-gh-release@v2
with:
files: fluence-cli-${{ inputs.platform }}.tar.gz
tag_name: ${{ inputs.tag }}
- name: Rename windows installer
if: inputs.platform == 'win32-x64'
run: mv packages/cli/package/dist/win32/fluence-*.exe fluence-cli-${{ inputs.platform }}.exe
- name: Upload windows installer to CI
if: inputs.platform == 'win32-x64'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.platform }}
path: fluence-cli-${{ inputs.platform }}.exe
- name: Upload windows installer to release
if: inputs.tag != 'null' && inputs.platform == 'win32-x64'
uses: softprops/action-gh-release@v2
with:
files: fluence-cli-${{ inputs.platform }}.exe
tag_name: ${{ inputs.tag }}
- name: Promote fluence-cli to unstable
if: inputs.tag != 'null' && inputs.platform != 'win32-x64'
working-directory: packages/cli/package
run: yarn oclif promote -t ${{ inputs.platform }} --version "$(jq .[] -r ../../../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel unstable --no-xz --indexes
- name: Promote fluence-cli windows to unstable
if: inputs.tag != 'null' && inputs.platform == 'win32-x64'
working-directory: packages/cli/package
run: yarn oclif promote -t ${{ inputs.platform }} --version "$(jq .[] -r ../../../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel unstable --win --no-xz --indexes