name: Create new release on: workflow_dispatch: inputs: new_version: description: 'New version' required: true type: string jobs: set-new-version: runs-on: ubuntu-latest outputs: commit_hash: ${{steps.commit_new_version.outputs.commit_hash}} steps: - uses: actions/checkout@v3 - name: Set new version format run: | if [[ "${{ inputs.new_version }}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then echo "New version looks okay"; MAJOR="${BASH_REMATCH[1]}" MINOR="${BASH_REMATCH[2]}" PATCH="${BASH_REMATCH[3]}" sed -r -i "s/TOTP_APP_VERSION_MAJOR\\s+\\([0-9]+\\)/TOTP_APP_VERSION_MAJOR ($MAJOR)/g" totp/version.h sed -r -i "s/TOTP_APP_VERSION_MINOR\\s+\\([0-9]+\\)/TOTP_APP_VERSION_MINOR ($MINOR)/g" totp/version.h sed -r -i "s/TOTP_APP_VERSION_PATCH\\s+\\([0-9]+\\)/TOTP_APP_VERSION_PATCH ($PATCH)/g" totp/version.h sed -r -i "s/fap_version=\"[0-9]+\\.[0-9]+\"/fap_version=\"$MAJOR.$MINOR$PATCH\"/g" totp/application.fam else echo "Invalid version format"; exit 1 fi - id: commit_new_version uses: stefanzweifel/git-auto-commit-action@v4.16.0 with: commit_message: Updated version push_options: '--force' build: runs-on: ubuntu-latest needs: set-new-version env: FBT_NO_SYNC: "true" TARGETS: f7 DEFAULT_TARGET: f7 steps: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - uses: actions/checkout@v3 with: ref: "${{needs.set-new-version.outputs.commit_hash}}" fetch-depth: 0 submodules: 'recursive' - name: Build run: ./build.ps1 shell: pwsh - uses: ncipollo/release-action@v1.12.0 with: artifacts: "build/*.fap,build/checksums.sha256" bodyFile: ".github/release-body.md" artifactErrorsFailBuild: true updateOnlyUnreleased: true allowUpdates: true removeArtifacts: true draft: true tag: "v${{ inputs.new_version }}" commit: "${{needs.set-new-version.outputs.commit_hash}}"