diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a107467d..4818a098 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,8 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - - - uses: actions/checkout@v2 with: fetch-depth: 0 @@ -37,8 +35,3 @@ jobs: args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Updating plugin - run: scripts/update_plugin.sh - env: - GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} diff --git a/scripts/update_plugin.sh b/scripts/update_plugin.sh index 2aeabcbd..ac5f2878 100755 --- a/scripts/update_plugin.sh +++ b/scripts/update_plugin.sh @@ -1,15 +1,25 @@ #!/usr/bin/env bash -echo "update plugin.yaml" +set -ex -sed -e "s/PLACEHOLDERVERSION/${GITHUB_REF##*/}/g" .github/plugin_template.yaml > plugin.yaml +function log() { + message=$1 + + echo `date +"%T"` $message +} -git fetch --all +log "Switching to master branch" git checkout master -git pull -git config --global user.name "GitHub Actions Build" -git config --global user.email github-action@aquasec.com + +log "Getting latest tags" +git fetch --tags +LATEST_TAG=`git describe --tag` + +sed -e "s/PLACEHOLDERVERSION/${GITHUB_REF##*/}/g" .github/plugin_template.yaml > plugin.yaml + +git checkout -b "plugin-update-${LATEST_TAG}" + git add plugin.yaml -git commit -m "GitHub Actions Build: Update plugin version" || true -git push --set-upstream origin HEAD:master || true +git commit -m "Updateing plugin to latest tag ${LATEST_TAG}" || true +git push --set-upstream origin "plugin-update-${LATEST_TAG}" || true