-
Notifications
You must be signed in to change notification settings - Fork 7
58 lines (56 loc) · 2.16 KB
/
reusable-release-policy-go.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
name: Build and release a Kubewarden policy written in Go
on:
workflow_call:
inputs:
oci-target:
type: string
required: true
artifacthub:
description: "check artifacthub-pkg.yml for submission to ArtifactHub"
required: false
type: boolean
default: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.3.5
- uses: actions/checkout@v4
with:
# until https://github.com/actions/checkout/pull/579 is released
fetch-depth: 0
- id: calculate-version
# skip when releasing :latest from main, versions will not match
if: startsWith(github.ref, 'refs/tags/v') && inputs.artifacthub
# obtain latest tag. Here it must be the current release tag
run: echo "version=$(git describe --tags --abbrev=0 | cut -c2-)" >> $GITHUB_OUTPUT
shell: bash
- name: Check that artifacthub-pkg.yml is up-to-date
# skip when releasing :latest from main, versions will not match
if: startsWith(github.ref, 'refs/tags/v') && inputs.artifacthub
uses: kubewarden/github-actions/check-artifacthub@v3.3.5
with:
version: ${{ steps.calculate-version.outputs.version }}
- name: Build and annotate policy
uses: kubewarden/github-actions/policy-build-tinygo@v3.3.5
- name: Run e2e tests
run: |
make e2e-tests
- name: Release
uses: kubewarden/github-actions/policy-release@v3.3.5
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
oci-target: ${{ inputs.oci-target }}
push-artifacthub:
# skip when releasing :latest from main, versions will not match
if: startsWith(github.ref, 'refs/tags/v') && inputs.artifacthub
needs: release
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
runs-on: ubuntu-latest
steps:
- name: Push artifacthub files to artifacthub branch
uses: kubewarden/github-actions/push-artifacthub@v3.3.5