Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support repos where there's no tag at all #144

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions .github/workflows/reusable-release-policy-assemblyscript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
NODE_VERSION: 14
steps:
- name: Install dependencies
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.1
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.2
- uses: actions/checkout@v4
with:
# until https://github.com/actions/checkout/pull/579 is released
Expand All @@ -34,17 +34,21 @@ jobs:
else
# Triggered via branch, version is not checked in artifacthub.
# Still, `make artifacthub-pkg.yml` needs a proper semver string.
#
# Use most recent tag with the number of additional commits on top
# of the tagged object & last commit hash (eg. v0.1.11-3-g8a36322),
# without the `v` prefix.
version=$(git describe --tags | cut -c2-)
if [ $(git describe --tags) ]; then
# Tag exists, use most recent tag with the number of additional
# commits on top of the tagged object & last commit hash (eg.
# v0.1.11-3-g8a36322), without the `v` prefix.
version=$(git describe --tags | cut -c2-)
else
# Tag doesn't exist, provide bogus version
version="0.0.0-$(git describe --always)-unreleased"
fi
fi
echo "version=$version" >> $GITHUB_OUTPUT
- 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.4.1
uses: kubewarden/github-actions/check-artifacthub@v3.4.2
with:
version: ${{ steps.calculate-version.outputs.version }}
- name: Setup node
Expand All @@ -67,7 +71,7 @@ jobs:
run: |
make e2e-tests
- name: Release
uses: kubewarden/github-actions/policy-release@v3.4.1
uses: kubewarden/github-actions/policy-release@v3.4.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
oci-target: ${{ inputs.oci-target }}
Expand All @@ -83,4 +87,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Push artifacthub files to artifacthub branch
uses: kubewarden/github-actions/push-artifacthub@v3.4.1
uses: kubewarden/github-actions/push-artifacthub@v3.4.2
24 changes: 14 additions & 10 deletions .github/workflows/reusable-release-policy-go-wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.1
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.2
- uses: actions/checkout@v4
with:
# until https://github.com/actions/checkout/pull/579 is released
Expand All @@ -32,26 +32,30 @@ jobs:
else
# Triggered via branch, version is not checked in artifacthub.
# Still, `make artifacthub-pkg.yml` needs a proper semver string.
#
# Use most recent tag with the number of additional commits on top
# of the tagged object & last commit hash (eg. v0.1.11-3-g8a36322),
# without the `v` prefix.
version=$(git describe --tags | cut -c2-)
if [ $(git describe --tags) ]; then
# Tag exists, use most recent tag with the number of additional
# commits on top of the tagged object & last commit hash (eg.
# v0.1.11-3-g8a36322), without the `v` prefix.
version=$(git describe --tags | cut -c2-)
else
# Tag doesn't exist, provide bogus version
version="0.0.0-$(git describe --always)-unreleased"
fi
fi
echo "version=$version" >> $GITHUB_OUTPUT
- 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.4.1
uses: kubewarden/github-actions/check-artifacthub@v3.4.2
with:
version: ${{ steps.calculate-version.outputs.version }}
- name: Build and annotate policy
uses: kubewarden/github-actions/policy-build-go-wasi@v3.4.1
uses: kubewarden/github-actions/policy-build-go-wasi@v3.4.2
- name: Run e2e tests
run: |
make e2e-tests
- name: Release
uses: kubewarden/github-actions/policy-release@v3.4.1
uses: kubewarden/github-actions/policy-release@v3.4.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
oci-target: ${{ inputs.oci-target }}
Expand All @@ -67,4 +71,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Push artifacthub files to artifacthub branch
uses: kubewarden/github-actions/push-artifacthub@v3.4.1
uses: kubewarden/github-actions/push-artifacthub@v3.4.2
24 changes: 14 additions & 10 deletions .github/workflows/reusable-release-policy-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.1
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.2
- uses: actions/checkout@v4
with:
# until https://github.com/actions/checkout/pull/579 is released
Expand All @@ -32,26 +32,30 @@ jobs:
else
# Triggered via branch, version is not checked in artifacthub.
# Still, `make artifacthub-pkg.yml` needs a proper semver string.
#
# Use most recent tag with the number of additional commits on top
# of the tagged object & last commit hash (eg. v0.1.11-3-g8a36322),
# without the `v` prefix.
version=$(git describe --tags | cut -c2-)
if [ $(git describe --tags) ]; then
# Tag exists, use most recent tag with the number of additional
# commits on top of the tagged object & last commit hash (eg.
# v0.1.11-3-g8a36322), without the `v` prefix.
version=$(git describe --tags | cut -c2-)
else
# Tag doesn't exist, provide bogus version
version="0.0.0-$(git describe --always)-unreleased"
fi
fi
echo "version=$version" >> $GITHUB_OUTPUT
- 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.4.1
uses: kubewarden/github-actions/check-artifacthub@v3.4.2
with:
version: ${{ steps.calculate-version.outputs.version }}
- name: Build and annotate policy
uses: kubewarden/github-actions/policy-build-tinygo@v3.4.1
uses: kubewarden/github-actions/policy-build-tinygo@v3.4.2
- name: Run e2e tests
run: |
make e2e-tests
- name: Release
uses: kubewarden/github-actions/policy-release@v3.4.1
uses: kubewarden/github-actions/policy-release@v3.4.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
oci-target: ${{ inputs.oci-target }}
Expand All @@ -67,4 +71,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Push artifacthub files to artifacthub branch
uses: kubewarden/github-actions/push-artifacthub@v3.4.1
uses: kubewarden/github-actions/push-artifacthub@v3.4.2
24 changes: 14 additions & 10 deletions .github/workflows/reusable-release-policy-rego.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.1
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.2
- uses: actions/checkout@v4
with:
# until https://github.com/actions/checkout/pull/579 is released
Expand All @@ -49,23 +49,27 @@ jobs:
else
# Triggered via branch, version is not checked in artifacthub.
# Still, `make artifacthub-pkg.yml` needs a proper semver string.
#
# Use most recent tag with the number of additional commits on top
# of the tagged object & last commit hash (eg. v0.1.11-3-g8a36322),
# without the `v` prefix.
version=$(git describe --tags | cut -c2-)
if [ $(git describe --tags) ]; then
# Tag exists, use most recent tag with the number of additional
# commits on top of the tagged object & last commit hash (eg.
# v0.1.11-3-g8a36322), without the `v` prefix.
version=$(git describe --tags | cut -c2-)
else
# Tag doesn't exist, provide bogus version
version="0.0.0-$(git describe --always)-unreleased"
fi
fi
fi
echo "version=$version" >> $GITHUB_OUTPUT
- name: Check that artifacthub-pkg.yml is up-to-date
# skip when releasing :latest from main, versions will not match
if: ${{ inputs.artifacthub && ( ! startsWith(github.ref, 'refs/heads/') ) }}
uses: kubewarden/github-actions/check-artifacthub@v3.4.1
uses: kubewarden/github-actions/check-artifacthub@v3.4.2
with:
version: ${{ steps.calculate-version.outputs.version }}
policy-working-dir: ${{ inputs.policy-working-dir }}
- name: Install opa
uses: kubewarden/github-actions/opa-installer@v3.4.1
uses: kubewarden/github-actions/opa-installer@v3.4.2
- uses: actions/checkout@v4
- name: Build policy
working-directory: ${{ inputs.policy-working-dir }}
Expand All @@ -83,7 +87,7 @@ jobs:
run: |
make e2e-tests
- name: Release
uses: kubewarden/github-actions/policy-release@v3.4.1
uses: kubewarden/github-actions/policy-release@v3.4.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
oci-target: ${{ inputs.oci-target }}
Expand All @@ -100,6 +104,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Push artifacthub files to artifacthub branch
uses: kubewarden/github-actions/push-artifacthub@v3.4.1
uses: kubewarden/github-actions/push-artifacthub@v3.4.2
with:
policy-working-dir: ${{ inputs.policy-working-dir }}
24 changes: 14 additions & 10 deletions .github/workflows/reusable-release-policy-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.1
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.2
- uses: actions/checkout@v4
with:
# until https://github.com/actions/checkout/pull/579 is released
Expand All @@ -32,26 +32,30 @@ jobs:
else
# Triggered via branch, version is not checked in artifacthub.
# Still, `make artifacthub-pkg.yml` needs a proper semver string.
#
# Use most recent tag with the number of additional commits on top
# of the tagged object & last commit hash (eg. v0.1.11-3-g8a36322),
# without the `v` prefix.
version=$(git describe --tags | cut -c2-)
if [ $(git describe --tags) ]; then
# Tag exists, use most recent tag with the number of additional
# commits on top of the tagged object & last commit hash (eg.
# v0.1.11-3-g8a36322), without the `v` prefix.
version=$(git describe --tags | cut -c2-)
else
# Tag doesn't exist, provide bogus version
version="0.0.0-$(git describe --always)-unreleased"
fi
fi
echo "version=$version" >> $GITHUB_OUTPUT
- 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.4.1
uses: kubewarden/github-actions/check-artifacthub@v3.4.2
with:
version: ${{ steps.calculate-version.outputs.version }}
- name: Build and annotate policy
uses: kubewarden/github-actions/policy-build-rust@v3.4.1
uses: kubewarden/github-actions/policy-build-rust@v3.4.2
- name: Run e2e tests
run: |
make e2e-tests
- name: Release
uses: kubewarden/github-actions/policy-release@v3.4.1
uses: kubewarden/github-actions/policy-release@v3.4.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
oci-target: ${{ inputs.oci-target }}
Expand All @@ -67,4 +71,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Push artifacthub files to artifacthub branch
uses: kubewarden/github-actions/push-artifacthub@v3.4.1
uses: kubewarden/github-actions/push-artifacthub@v3.4.2
22 changes: 13 additions & 9 deletions .github/workflows/reusable-release-policy-swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.1
uses: kubewarden/github-actions/policy-gh-action-dependencies@v3.4.2
- uses: actions/checkout@v4
with:
# until https://github.com/actions/checkout/pull/579 is released
Expand All @@ -32,17 +32,21 @@ jobs:
else
# Triggered via branch, version is not checked in artifacthub.
# Still, `make artifacthub-pkg.yml` needs a proper semver string.
#
# Use most recent tag with the number of additional commits on top
# of the tagged object & last commit hash (eg. v0.1.11-3-g8a36322),
# without the `v` prefix.
version=$(git describe --tags | cut -c2-)
if [ $(git describe --tags) ]; then
# Tag exists, use most recent tag with the number of additional
# commits on top of the tagged object & last commit hash (eg.
# v0.1.11-3-g8a36322), without the `v` prefix.
version=$(git describe --tags | cut -c2-)
else
# Tag doesn't exist, provide bogus version
version="0.0.0-$(git describe --always)-unreleased"
fi
fi
echo "version=$version" >> $GITHUB_OUTPUT
- 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.4.1
uses: kubewarden/github-actions/check-artifacthub@v3.4.2
with:
version: ${{ steps.calculate-version.outputs.version }}
- name: install wasm-strip
Expand All @@ -68,7 +72,7 @@ jobs:
run: |
make e2e-tests
- name: Release
uses: kubewarden/github-actions/policy-release@v3.4.1
uses: kubewarden/github-actions/policy-release@v3.4.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
oci-target: ${{ inputs.oci-target }}
Expand All @@ -84,4 +88,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Push artifacthub files to artifacthub branch
uses: kubewarden/github-actions/push-artifacthub@v3.4.1
uses: kubewarden/github-actions/push-artifacthub@v3.4.2
18 changes: 11 additions & 7 deletions .github/workflows/reusable-test-policy-assemblyscript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# until https://github.com/actions/checkout/pull/579 is released
fetch-depth: 0
- name: Install kwctl
uses: kubewarden/github-actions/kwctl-installer@v3.4.1
uses: kubewarden/github-actions/kwctl-installer@v3.4.2
- id: calculate-version
shell: bash
run: |
Expand All @@ -46,15 +46,19 @@ jobs:
else
# Triggered via branch, version is not checked in artifacthub.
# Still, `make artifacthub-pkg.yml` needs a proper semver string.
#
# Use most recent tag with the number of additional commits on top
# of the tagged object & last commit hash (eg. v0.1.11-3-g8a36322),
# without the `v` prefix.
version=$(git describe --tags | cut -c2-)
if [ $(git describe --tags) ]; then
# Tag exists, use most recent tag with the number of additional
# commits on top of the tagged object & last commit hash (eg.
# v0.1.11-3-g8a36322), without the `v` prefix.
version=$(git describe --tags | cut -c2-)
else
# Tag doesn't exist, provide bogus version
version="0.0.0-$(git describe --always)-unreleased"
fi
fi
echo "version=$version" >> $GITHUB_OUTPUT
- name: Check that artifacthub-pkg.yml is up-to-date
uses: kubewarden/github-actions/check-artifacthub@v3.4.1
uses: kubewarden/github-actions/check-artifacthub@v3.4.2
with:
version: ${{ steps.calculate-version.outputs.version }}
check_version: false # must match a git tag that hasn't been created yet, so let's ignore until then
Loading
Loading