chore(deps): bump the kong-packages group with 18 updates (#462) #821
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: Test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
# [NOTE] branches | |
# On main branch: main | |
# On release branch: release/** | |
branches: ["main"] | |
# [NOTE] tags | |
# On main branch: nightly | |
# On release branch: vX.X.** | |
tags: ["nightly"] | |
jobs: | |
build: | |
name: Build | |
uses: ./.github/workflows/.reusable_build.yml | |
secrets: inherit | |
build-test-image: | |
name: Build Test Image | |
uses: ./.github/workflows/.reusable_test_image.yml | |
needs: build | |
secrets: inherit | |
e2e-tests: | |
name: E2E Tests | |
needs: build-test-image | |
uses: ./.github/workflows/.reusable_e2e_tests.yml | |
secrets: inherit | |
with: | |
gateway-image: ${{ needs.build-test-image.outputs.image }} | |
load-test-image-from-artifact: true | |
e2e-tests-csp-on: | |
name: E2E Tests (CSP on) | |
needs: build-test-image | |
uses: ./.github/workflows/.reusable_e2e_tests.yml | |
secrets: inherit | |
with: | |
gateway-image: ${{ needs.build-test-image.outputs.image }} | |
load-test-image-from-artifact: true | |
enable-csp-header: true | |
create-release: | |
if: >- | |
github.event_name == 'push' && ( | |
github.ref == 'refs/heads/main' || | |
startsWith(github.ref, 'refs/heads/release/') || | |
startsWith(github.ref, 'refs/tags/') | |
) | |
name: Create Release | |
needs: [e2e-tests, e2e-tests-csp-on] | |
runs-on: ${{ vars.RUNS_ON }} | |
permissions: | |
contents: write | |
steps: | |
- name: Download release | |
timeout-minutes: 5 | |
uses: actions/download-artifact@v4 | |
with: | |
name: release | |
- name: Create nightly release | |
if: "github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')" | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GH_REPOSITORY: ${{ github.repository }} | |
# [NOTE] RELEASE_TAG_NAME | |
# On main branch: nightly | |
# On release branch: vX.X-nightly | |
RELEASE_TAG_NAME: nightly | |
RELEASE_TARGET: ${{ github.sha }} | |
run: | | |
previous=$( | |
gh release view $RELEASE_TAG_NAME -R $GH_REPOSITORY >/dev/null 2>&1 | |
if [[ $? == 0 ]]; then | |
echo true | |
else | |
echo false | |
fi | |
) | |
if $previous; then | |
echo "Deleting the existing release..." | |
gh release delete $RELEASE_TAG_NAME -R $GH_REPOSITORY --cleanup-tag -y | |
else | |
echo "No previous release found" | |
fi | |
echo "Deleting the associated tag..." | |
gh api \ | |
--method DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/$GH_REPOSITORY/git/refs/tags/$RELEASE_TAG_NAME >/dev/null 2>&1 || true | |
echo "Creating a new release with assets..." | |
gh release create $RELEASE_TAG_NAME -t $RELEASE_TAG_NAME --target $RELEASE_TARGET -R $GH_REPOSITORY release.tar.gz | |
- name: Create non-nightly (tagged) release | |
if: startsWith(github.ref, 'refs/tags/') | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GH_REPOSITORY: ${{ github.repository }} | |
RELEASE_TAG_NAME: ${{ github.ref_name }} # this is the tag name | |
RELEASE_TARGET: ${{ github.sha }} | |
run: | | |
previous=$( | |
gh release view $RELEASE_TAG_NAME -R $GH_REPOSITORY >/dev/null 2>&1 | |
if [[ $? == 0 ]]; then | |
echo true | |
else | |
echo false | |
fi | |
) | |
if $previous; then | |
echo "Release already exists" | |
echo "Replacing assets..." | |
gh release upload $RELEASE_TAG_NAME release.tar.gz --clobber -R $GH_REPOSITORY | |
else | |
echo "No previous release found" | |
echo "Creating a new release with assets..." | |
gh release create $RELEASE_TAG_NAME -t $RELEASE_TAG_NAME --target $RELEASE_TARGET -R $GH_REPOSITORY release.tar.gz | |
fi |