Skip to content

Commit

Permalink
Update create-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
bardabun authored May 22, 2024
1 parent 02d6162 commit c256df0
Showing 1 changed file with 17 additions and 37 deletions.
54 changes: 17 additions & 37 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: update version and create new release
on:
release:
types: [published]
push:
branches:
- master
paths-ignore:
- '.github/**'
- 'configs/**'
Expand All @@ -21,28 +22,13 @@ jobs:
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
Expand All @@ -65,10 +51,9 @@ jobs:
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
git push
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}

Expand All @@ -79,18 +64,13 @@ jobs:
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: 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
Expand Down Expand Up @@ -127,12 +107,12 @@ jobs:
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/**"
- 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 c256df0

Please sign in to comment.