Skip to content

Commit

Permalink
automated release creation
Browse files Browse the repository at this point in the history
  • Loading branch information
devloberto committed Mar 30, 2024
1 parent a84f1d3 commit eef9eeb
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 2 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
major_version:
type: number
required: true
minor_version:
type: number
required: true
patch_version:
type: number
required: true

env:
ARTIFACT_DIR: FritzBoxShell-${{ github.ref_name }}
RELEASE_NAME: ${{ github.event_name == 'push' && github.ref_name || format('v{0}.{1}.{2}', inputs.major_version, inputs.minor_version, inputs.patch_version) }}

jobs:
create-artifacts:
runs-on: ubuntu-latest
steps:
- name: setup rsync
uses: GuillaumeFalourd/[email protected]
- name: git checkout
uses: actions/checkout@v2
- name: inject version automatically
run: sed -i "s|version=.*\.dev|version=$(echo "${{ env.RELEASE_NAME }}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')|" fritzBoxShell.sh
- name: create artifact directory
run: |
mkdir ${{ env.ARTIFACT_DIR }}
rsync -arv --progress --exclude=".git*" --exclude="${{ env.ARTIFACT_DIR }}" . ${{ env.ARTIFACT_DIR }}
- name: create .zip artifact
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: ${{ env.RELEASE_NAME }}.zip
path: ./${{ env.ARTIFACT_DIR }}
- name: create .tar.gz artifact
uses: thedoctor0/[email protected]
with:
type: 'tar'
filename: ${{ env.RELEASE_NAME }}.tar.gz
path: ./${{ env.ARTIFACT_DIR }}
- name: collect artifacts
run: |
mkdir artifacts
mv ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}.zip artifacts
- name: upload artifacts
# @todo replace by an action like https://github.com/marketplace/actions/gh-release
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_NAME }}
path: 'artifacts/*'
- name: release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
artifacts/${{ env.RELEASE_NAME }}.zip
artifacts/${{ env.RELEASE_NAME }}.tar.gz
4 changes: 2 additions & 2 deletions fritzBoxShell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# AVM, FRITZ!, Fritz!Box and the FRITZ! logo are registered trademarks of AVM GmbH - https://avm.de/


version=1.0.9
version=1.0.dev

dir=$(dirname "$0")

Expand Down Expand Up @@ -1097,4 +1097,4 @@ else
Reboot "$option2"
else DisplayArguments
fi
fi
fi

0 comments on commit eef9eeb

Please sign in to comment.