-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (157 loc) · 4.74 KB
/
Copy pathdevelop.yaml
File metadata and controls
182 lines (157 loc) · 4.74 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
176
177
178
179
180
181
182
name: Develop
on:
push:
pull_request:
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Build and test
run: make test
- name: Report test coverage
uses: ncruces/go-coverage-report@v0
with:
coverage-file: coverage.out
chart: true
amend: true
continue-on-error: true
if: |
github.event_name == 'push'
build-pulumi-plugin:
needs: build-and-test
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: arm64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Set plugin version
id: version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
# if current ref is tag
VERSION="${GITHUB_REF_NAME}"
echo "type=tag" >> $GITHUB_OUTPUT
echo "PROVIDER_VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Using tag: ${VERSION}"
else
# Fallback to short SHA for branches
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-8)
VERSION="${SHORT_SHA}"
echo "type=sha" >> $GITHUB_OUTPUT
echo "PROVIDER_VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Using SHA: ${VERSION}"
fi
# Also output the full SHA for reference
echo "full_sha=${GITHUB_SHA}" >> $GITHUB_OUTPUT
- name: Build Pulumi plugin
run: PROVIDER_VERSION=${{ steps.version.outputs.PROVIDER_VERSION }} make plugin
- name: Publish Pulumi plugin
uses: actions/upload-artifact@v4
with:
name: pulumi-gcp-vertex-model-deployment-${{ matrix.goos }}-${{ matrix.goarch }}
path: build/pulumi-resource-gcp-vertex-model-deployment-*.tar.gz
lint:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Lint Go code
run: make lint
scan:
runs-on: ubuntu-latest
needs: build-and-test
permissions:
contents: write # for sbom-action artifact uploads
actions: read # to find workflow artifacts when attaching release assets
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate SBOM
uses: anchore/sbom-action@v0.20.4
with:
path: .
format: spdx-json
output-file: sbom.spdx.json
- name: Scan SBOM with Grype
id: scan
uses: anchore/scan-action@v6
with:
sbom: sbom.spdx.json
fail-build: true
severity-cutoff: medium
output-format: table
release:
runs-on: ubuntu-latest
needs: build-pulumi-plugin
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v5
with:
path: artifacts
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
--generate-notes
- name: Upload release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
# Upload artifacts for each architecture
for artifact_dir in artifacts/*/; do
if [ -d "$artifact_dir" ]; then
echo "Uploading assets from $artifact_dir"
for file in "$artifact_dir"*; do
if [ -f "$file" ]; then
filename=$(basename "$file")
echo "Uploading $filename"
gh release upload "$tag" "$file" --clobber --repo="$GITHUB_REPOSITORY"
fi
done
fi
done