diff --git a/.github/workflows/clone-post.yml b/.github/workflows/clone-post.yml index 7ac74b4..743d4ba 100644 --- a/.github/workflows/clone-post.yml +++ b/.github/workflows/clone-post.yml @@ -48,8 +48,42 @@ jobs: else git commit -m "Cloned WordPress post ${{ github.event.inputs.postID }} for environment ${{ github.event.inputs.environment }}" git push - fi + - name: Get the current version tag + id: get_version + run: | + TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "Current version tag: $TAG" + echo "::set-output name=version::${TAG}" + + - name: Calculate new version + id: new_version + run: | + CURRENT_VERSION=${{ steps.get_version.outputs.version }} + MAJOR=$(echo $CURRENT_VERSION | cut -d'.' -f1) + MINOR=$(echo $CURRENT_VERSION | cut -d'.' -f2) + PATCH=$(echo $CURRENT_VERSION | cut -d'.' -f3) + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}" + echo "New version: $NEW_VERSION" + echo "::set-output name=new_version::$NEW_VERSION" + + - name: Create and push tag + run: | + NEW_TAG=${{ steps.new_version.outputs.new_version }} + git tag $NEW_TAG + git push origin $NEW_TAG + + - name: Create GitHub release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.new_version.outputs.new_version }} + release_name: Release ${{ steps.new_version.outputs.new_version }} + draft: false + prerelease: false + upload_to_s3: needs: clone_post runs-on: ubuntu-latest