Skip to content

Commit

Permalink
Merge pull request #42 from HollowMan6/release
Browse files Browse the repository at this point in the history
Version bumps start PRs instead of committing directly
  • Loading branch information
David Wertenteil authored May 2, 2023
2 parents da5eef9 + 583aa2d commit dfcc7e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Release with upstream
name: Check release with upstream

on:
workflow_dispatch: # Allow manual triggers
push:
# Publish `v1.2.3` tags as releases.
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
branches: [ main ]

env:
BOT_NAME: "github-actions[bot]"
Expand All @@ -15,23 +13,35 @@ jobs:
update:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to release, commit and push the changed files back to the repository.
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Update repo
run: |
. ./update.sh
echo "latest=${LATEST}" >> $GITHUB_ENV
echo "current=${CURRENT}" >> $GITHUB_ENV
- uses: stefanzweifel/git-auto-commit-action@v4
git clone https://github.com/${{ github.repository }} github-action; cd github-action
export RELEASE=$(git for-each-ref --format="%(refname:short)" --sort=-authordate --count=1 refs/tags || true)
rm -rf github-action
echo "release=${RELEASE}" >> $GITHUB_ENV
- uses: peter-evans/create-pull-request@v4
if: env.latest != env.current
with:
commit_author: "${{ env.BOT_NAME }} <${{ env.BOT_EMAIL }}>"
commit_message: Bump kubescape version into ${{ env.latest }}
add-paths: |
Dockerfile
commit-message: "Bump kubescape version into ${{ env.latest }}"
title: "[Kubescape] Bump kubescape version into ${{ env.latest }}"
body: |
# Overview
This PR bumps the kubescape version used in this action Docker image to the latest: ${{ env.latest }}
base: ${{ github.head_ref }}
branch: kubescape-bump-${{ env.latest }}-${{ github.head_ref || github.ref_name }}
delete-branch: true
- name: Release
if: env.latest != env.current
if: env.release != env.current
uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d
with:
tag_name: ${{ env.latest }}
body: Bump kubescape version into ${{ env.latest }}
tag_name: ${{ env.current }}
body: Bump kubescape version into ${{ env.current }}
2 changes: 1 addition & 1 deletion update.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
git clone https://github.com/kubescape/kubescape.git --no-checkout
cd kubescape
export LATEST=$(git describe --tags --abbrev=0)
export LATEST=$(git for-each-ref --format="%(refname:short)" --sort=-authordate --count=1 refs/tags)
cd ..
rm -rf kubescape
export CURRENT=$(cat Dockerfile | head -n1 | cut -d':' -f2)
Expand Down

0 comments on commit dfcc7e1

Please sign in to comment.