-
Notifications
You must be signed in to change notification settings - Fork 37
170 lines (146 loc) · 5.89 KB
/
release.yml
File metadata and controls
170 lines (146 loc) · 5.89 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
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
permissions: # added using https://github.com/step-security/secure-repo
contents: write
jobs:
build-figma-resources:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v3.5.2
with:
submodules: 'recursive'
- name: Set version for Widget
working-directory: support-figma/auto-content-preview-widget
run: |
BRANCH_NAME=$(echo "${{ github.ref_name }}" | sed 's_/_\\/_g')
sed -i -e "s/\(\"name\":.*\)\",/\1 ${BRANCH_NAME}\",/" manifest.json
- uses: ./.github/actions/build-figma-resource
with:
resource: auto-content-preview-widget
- uses: ./.github/actions/build-figma-resource
with:
resource: extended-layout-plugin
build-maven-repo:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: "Set environment variables"
run: |
echo "ORG_GRADLE_PROJECT_DesignComposeMavenRepo=$GITHUB_WORKSPACE/designcompose_m2repo" >> "$GITHUB_ENV"
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v3.5.2
with:
submodules: 'recursive'
- name: Set up Build
uses: ./.github/actions/setup-build
with:
setup-gradle: true
setup-protoc: true
setup-rust: true
- name: Build Maven repo
run: ./gradlew -PdesignComposeReleaseVersion=${{ github.ref_name }} publishAllPublicationsToLocalDirRepository
- name: Upload
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: designcompose_m2repo
path: designcompose_m2repo
build-rust-cli:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v3.5.2
with:
submodules: 'recursive'
- name: Set up Build
uses: ./.github/actions/setup-build
with:
setup-rust: true
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build binaries
run: |
cross build --release --target ${{ matrix.target }} --package dc_figma_import --bin fetch --features="fetch"
cross build --release --target ${{ matrix.target }} --package dc_figma_import --bin dcf_info --features="dcf_info"
- name: Package binaries
shell: bash
run: |
TARGET=${{ matrix.target }}
ARTIFACT_DIR="figma-tools-${TARGET}"
mkdir -p "${ARTIFACT_DIR}"
if [[ "${TARGET}" == *"-windows-"* ]]; then
cp "target/${TARGET}/release/fetch.exe" "${ARTIFACT_DIR}/"
cp "target/${TARGET}/release/dcf_info.exe" "${ARTIFACT_DIR}/"
zip -q -r "${ARTIFACT_DIR}.zip" "${ARTIFACT_DIR}"
echo "ASSET_PATH=${ARTIFACT_DIR}.zip" >> "$GITHUB_ENV"
else
cp "target/${TARGET}/release/fetch" "${ARTIFACT_DIR}/"
cp "target/${TARGET}/release/dcf_info" "${ARTIFACT_DIR}/"
tar -czf "${ARTIFACT_DIR}.tar.gz" "${ARTIFACT_DIR}"
echo "ASSET_PATH=${ARTIFACT_DIR}.tar.gz" >> "$GITHUB_ENV"
fi
- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: figma-tools-${{ matrix.target }}
path: ${{ env.ASSET_PATH }}
upload-release:
runs-on: ubuntu-latest
needs:
- build-figma-resources
- build-maven-repo
- build-rust-cli
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v3.5.2
with:
submodules: 'recursive'
# Download all artifacts
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
- name: Zip releases
run: |
zip -q -r designcompose_m2repo-${{ github.ref_name }}.zip designcompose_m2repo/
zip -q -r extended-layout-plugin-${{ github.ref_name }}.zip extended-layout-plugin/
zip -q -r auto-content-preview-widget-${{ github.ref_name }}.zip auto-content-preview-widget/
- name: Upload release artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.ref_name }} \
extended-layout-plugin-${{ github.ref_name }}.zip \
auto-content-preview-widget-${{ github.ref_name }}.zip \
designcompose_m2repo-${{ github.ref_name }}.zip \
figma-tools-*/*