Skip to content

Commit

Permalink
Revert "Delete .github/workflows/create-release.yml"
Browse files Browse the repository at this point in the history
This reverts commit a1081de.
  • Loading branch information
bardabun committed May 22, 2024
1 parent a1081de commit 02d6162
Showing 1 changed file with 138 additions and 0 deletions.
138 changes: 138 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: update version and create new release
on:
release:
types: [published]
paths-ignore:
- '.github/**'
- 'configs/**'
- 'config-templates/**'
- 'testing-configs/**'
- '.gitignore'
- 'LICENSE'
- 'README.md'
- 'version'

jobs:
update_version:
name: Update Version
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: Check version file existence
run: |
if [ ! -f ./version ]; then
echo "Error: version file does not exist."
exit 1
fi
echo "version file exists."
- name: Print version file content
run: |
echo "version file content:"
cat ./version
- name: Increase Version
run: |
version=$(cat ./version | grep -o -e '[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}')
major=$(echo "$version" | cut -d'.' -f1)
minor=$(echo "$version" | cut -d'.' -f2)
patch=$(echo "$version" | cut -d'.' -f3)
echo "Major version: $major"
echo "Minor version: $minor"
echo "Patch version: $patch"
if [[ $patch -lt 99 ]]; then
((patch++))
elif [[ $minor -lt 99 ]]; then
patch=0
((minor++))
else
patch=0
minor=0
((major++))
fi
next_version="v$major.$minor.$patch"
echo "$next_version" >./version
- name: Create Github Output Env
id: version
run: |
version=$(cat ./version)
echo "VERSION=$version" >> $GITHUB_OUTPUT
- name: Push Change
run: |
git config --global user.name ShiranAvidov
git config --global user.email [email protected]
git checkout -b add-user-agent-header
git add ./version
git commit -m "update version"
git push origin add-user-agent-header
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}

create_release:
name: Create Release
runs-on: ubuntu-latest
needs: update_version
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set User-Agent Headers
id: set-headers
run: |
RELEASE_VERSION="${{ needs.update_version.outputs.VERSION }}"
echo "release_version=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Update version file
run: |
echo "${{ needs.update_version.outputs.VERSION }}" >./version
# - name: Push tag
# run: |
# git tag "${{ needs.update_version.outputs.VERSION }}"
# git push origin "${{ needs.update_version.outputs.VERSION }}"
- name: Install zip
run: |
sudo apt-get install zip -y
- name: Create assets directory
run : |
mkdir assets
- name: Compress Windows Files
run: |
mkdir tmp
cd tmp
cp -r ${GITHUB_WORKSPACE}/scripts/windows/. ${GITHUB_WORKSPACE}/version .
zip -r ${GITHUB_WORKSPACE}/assets/agent_windows.zip .
rm -r ./*
cp -r ${GITHUB_WORKSPACE}/datasources/windows/. ${GITHUB_WORKSPACE}/resources .
zip -r ${GITHUB_WORKSPACE}/assets/windows_kubernetes_aks.zip kubernetes/aks resources
zip -r ${GITHUB_WORKSPACE}/assets/windows_kubernetes_eks.zip kubernetes/eks resources
zip -r ${GITHUB_WORKSPACE}/assets/windows_kubernetes_gke.zip kubernetes/gke resources
zip -r ${GITHUB_WORKSPACE}/assets/windows_kubernetes_digitalocean.zip kubernetes/digitalocean resources
zip -r ${GITHUB_WORKSPACE}/assets/windows_localhost_windows.zip localhost/windows resources
- name: Compress Linux Files
run: |
tar -czvf assets/agent_linux.tar.gz -C scripts/linux . -C ${GITHUB_WORKSPACE} version
tar -czvf assets/linux_kubernetes_aks.tar.gz -C datasources/linux kubernetes/aks -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_kubernetes_eks.tar.gz -C datasources/linux kubernetes/eks -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_kubernetes_gke.tar.gz -C datasources/linux kubernetes/gke -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_kubernetes_digitalocean.tar.gz -C datasources/linux kubernetes/digitalocean -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_aws_ec2.tar.gz -C datasources/linux aws/ec2 -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_localhost_linux.tar.gz -C datasources/linux localhost/linux -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
- name: Compress Mac Files
run: |
tar -czvf assets/agent_mac.tar.gz -C scripts/mac . -C ${GITHUB_WORKSPACE} version
tar -czvf assets/mac_kubernetes_aks.tar.gz -C datasources/mac kubernetes/aks -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
tar -czvf assets/mac_kubernetes_eks.tar.gz -C datasources/mac kubernetes/eks -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
tar -czvf assets/mac_kubernetes_gke.tar.gz -C datasources/mac kubernetes/gke -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
tar -czvf assets/mac_kubernetes_digitalocean.tar.gz -C datasources/mac kubernetes/digitalocean -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
tar -czvf assets/mac_localhost_mac.tar.gz -C datasources/mac localhost/mac -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
# - name: Create Release
# uses: ncipollo/release-action@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# tag: ${{ needs.update_version.outputs.VERSION }}
# name: ${{ needs.update_version.outputs.VERSION }}
# body: |
# New Release ${{ needs.update_version.outputs.VERSION }}
# artifacts: "assets/**"

0 comments on commit 02d6162

Please sign in to comment.