-
Notifications
You must be signed in to change notification settings - Fork 50
167 lines (149 loc) · 6.39 KB
/
release-cpp.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Release C++ SDK
run-name: Release C++ SDK ${{ inputs.release_type }}
on:
workflow_dispatch:
inputs:
release_type:
description: "Release Options"
required: true
default: "Release"
type: choice
options:
- Release
- Dry Run
env:
_KEY_VAULT: "bitwarden-ci"
jobs:
validate:
name: Setup
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Branch check
if: ${{ inputs.release_type != 'Dry Run' }}
run: |
if [[ "$GITHUB_REF" != "refs/heads/main" ]] ; then
echo "==================================="
echo "[!] Can only release from the 'main' branches"
echo "==================================="
exit 1
fi
- name: Get version
id: version
run: |
VERSION=$(cat languages/cpp/vcpkg.json | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")
echo "version=$VERSION" >> $GITHUB_OUTPUT
github-release:
name: GitHub Release
runs-on: ubuntu-22.04
needs: validate
env:
_PKG_VERSION: ${{ needs.validate.outputs.version }}
steps:
- name: Login to Azure - Prod Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
- name: Retrieve secrets
id: retrieve-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: ${{ env._KEY_VAULT }}
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
- name: Download x86_64-apple-darwin C artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
artifacts: libbitwarden_c_files-x86_64-apple-darwin
skip_unpack: true
- name: Download aarch64-apple-darwin C artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
artifacts: libbitwarden_c_files-aarch64-apple-darwin
skip_unpack: true
- name: Download x86_64-unknown-linux-gnu C artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu
skip_unpack: true
- name: Download x86_64-pc-windows-msvc C artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc
skip_unpack: true
- name: Rename C build artifacts
run: |
artifacts=("x86_64-apple-darwin" "aarch64-apple-darwin" "x86_64-unknown-linux-gnu" "x86_64-pc-windows-msvc") # aarch64-unknown-linux-gnu)
for value in "${artifacts[@]}"
do
unzip libbitwarden_c_files-$value.zip -d libbitwarden_c_files-$value
cd libbitwarden_c_files-$value
zip -Rj ../libbitwarden_c_files-$value-$_PKG_VERSION.zip 'libbitwarden_c.*'
cd ..
done
- name: Download schemas
uses: bitwarden/gh-actions/download-artifacts@main
with:
name: sdk-schemas-cpp
workflow: generate_schemas.yml
workflow_conclusion: success
branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
artifacts: sdk-schemas-cpp
skip_unpack: true
- name: Rename schemas artifacts
run: mv sdk-schemas-cpp.zip sdk-schemas-cpp-$_PKG_VERSION.zip
- name: Download x86_64-apple-darwin C++ artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-cpp.yml
workflow_conclusion: success
branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
artifacts: libbitwarden_cpp-x86_64-apple-darwin
skip_unpack: true
- name: Download x86_64-unknown-linux-gnu C++ artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-cpp.yml
workflow_conclusion: success
branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
artifacts: libbitwarden_cpp-x86_64-unknown-linux-gnu
skip_unpack: true
- name: Rename C++ build artifacts
run: |
artifacts=("x86_64-apple-darwin" "x86_64-unknown-linux-gnu") # "x86_64-pc-windows-msvc" "aarch64-apple-darwin" "aarch64-unknown-linux-gnu")
for value in "${artifacts[@]}"
do
mv libbitwarden_cpp-$value.zip libbitwarden_cpp_files-$value-$_PKG_VERSION.zip
done
- name: Create release
if: ${{ inputs.release_type != 'Dry Run' }}
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
tag: cpp-sdk-v${{ env._PKG_VERSION }}
name: "C++ SDK v${{ env._PKG_VERSION }}"
body: "<insert release notes here>"
token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
draft: true
repo: sdk
owner: bitwarden
artifacts: "libbitwarden_c_files-x86_64-apple-darwin-${{ env._PKG_VERSION }}.zip,
libbitwarden_c_files-aarch64-apple-darwin-${{ env._PKG_VERSION }}.zip,
libbitwarden_c_files-x86_64-unknown-linux-gnu-${{ env._PKG_VERSION }}.zip,
libbitwarden_c_files-x86_64-pc-windows-msvc-${{ env._PKG_VERSION }}.zip,
libbitwarden_cpp_files-x86_64-unknown-linux-gnu-${{ env._PKG_VERSION }}.zip,
libbitwarden_cpp_files-x86_64-apple-darwin-${{ env._PKG_VERSION }}.zip,
sdk-schemas-cpp-${{ env._PKG_VERSION }}.zip"