fix go mod name #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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-vertex-model-deployment-${{ matrix.goos }}-${{ matrix.goarch }} | |
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 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Generate SBOM | |
uses: anchore/[email protected] | |
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" --repo="$GITHUB_REPOSITORY" | |
fi | |
done | |
fi | |
done |