Repository navigation
97 lines (90 loc) · 3.9 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (90 loc) · 3.9 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
name: Release
# Push a tag like v0.1.0. This gates on CI, then the shared vgi-actions workflow
# builds the worker (cgo, embedded DuckDB evaluator) on native runners (linux amd64/arm64, macOS arm64,
# Windows amd64), signs each archive with cosign, attests SLSA provenance, and
# attaches them to the GitHub release.
on:
push:
tags: ['v*.*.*']
workflow_dispatch:
permissions:
contents: read
jobs:
ci-status:
# A release tag usually points at a commit whose push to main already passed CI.
# Reuse that result instead of running the whole CI matrix again; otherwise run CI below.
# In the template repositories a vX.Y.Z tag is a template version, not a worker
# release, so only a manual run builds there. Forks release on every tag.
if: ${{ github.event_name != 'push' || !startsWith(github.repository, 'Query-farm/vgi-starter-') }}
runs-on: ubuntu-latest
permissions:
actions: read
outputs:
passed: ${{ steps.check.outputs.passed }}
steps:
- id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
n=$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/ci.yml/runs?head_sha=${GITHUB_SHA}&status=success&per_page=1" --jq .total_count || echo 0)
echo "ci.yml successes for ${GITHUB_SHA}: ${n:-0}"
if [ "${n:-0}" -gt 0 ]; then echo "passed=true" >> "$GITHUB_OUTPUT"; else echo "passed=false" >> "$GITHUB_OUTPUT"; fi
ci:
needs: [ci-status]
if: ${{ needs.ci-status.outputs.passed != 'true' }}
uses: ./.github/workflows/ci.yml
release:
needs: [ci-status, ci]
if: ${{ !cancelled() && needs.ci-status.result == 'success' && (needs.ci.result == 'success' || needs.ci.result == 'skipped') }}
permissions:
contents: write # create the release, attach assets
id-token: write # keyless signing + provenance
attestations: write
uses: Query-farm/vgi-actions/.github/workflows/go-release.yml@v1
secrets: inherit
with:
package: ./cmd/vgi-steampipe-worker
bin: vgi-steampipe-worker
go_version: "1.26"
# The worker imports vgi-go/vgi/exprduckdb (embedded DuckDB): cgo.
cgo: "1"
version_check_cmd: ci/check-version.sh
# The Steampipe fixture plugin that the examples' vgi.executable_examples run
# against (test/fixture-plugin). Published with each release so a catalog
# harvest can ATTACH ... (plugins 'fixture=<path>') and verify the examples
# the way CI does. Test fixture only: not for production use.
fixture-plugin:
name: fixture plugin (${{ matrix.goos }}_${{ matrix.goarch }})
needs: [release]
# !cancelled(): ci is skipped when CI already passed on this commit, and a
# skipped job anywhere in the needs chain would otherwise skip this one too.
if: ${{ !cancelled() && needs.release.result == 'success' && startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
include:
- { goos: linux, goarch: amd64 }
- { goos: linux, goarch: arm64 }
- { goos: darwin, goarch: arm64 }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: test/fixture-plugin/go.mod
- name: Build
env:
CGO_ENABLED: "0"
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
out="$RUNNER_TEMP/steampipe-plugin-fixture-${{ matrix.goos }}_${{ matrix.goarch }}"
(cd test/fixture-plugin && go build -trimpath -o "$out" .)
(cd "$RUNNER_TEMP" && sha256sum "$(basename "$out")" > "$(basename "$out").sha256")
- name: Upload to the release
env:
GH_TOKEN: ${{ github.token }}
run: |
f="$RUNNER_TEMP/steampipe-plugin-fixture-${{ matrix.goos }}_${{ matrix.goarch }}"
gh release upload "$GITHUB_REF_NAME" "$f" "$f.sha256" --clobber --repo "$GITHUB_REPOSITORY"