Create Release #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Release | |
on: | |
workflow_dispatch: | |
inputs: | |
release-type: | |
type: choice | |
options: | |
- minor_beta | |
- major_beta | |
- patch | |
- minor | |
- major | |
required: true | |
jobs: | |
get-version: | |
name: "Get Version" | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.fetch_version.outputs.version }} | |
is-beta: ${{ steps.fetch_version.outputs.is-beta }} | |
branch: ${{ steps.set_branch.outputs.result }} | |
steps: | |
- name: Fetch Version From API | |
uses: Macro-Deck-App/Actions/fetch-version@main | |
id: fetch_version | |
with: | |
release-type: ${{ inputs.release-type }} | |
- name: Set branch name | |
id: set_branch | |
run: | | |
if [[ "${{ steps.fetch_version.outputs.is-beta }}" == "true" ]]; then | |
echo "::set-output name=result::develop" | |
else | |
echo "::set-output name=result::main" | |
fi | |
bump-version: | |
name: "Bump Version" | |
runs-on: ubuntu-latest | |
needs: [get-version] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.get-version.outputs.branch }} | |
- name: Update CSProj Version | |
run: | | |
sed -i 's/<Version>.*<\/Version>/<Version>${{ needs.get-version.outputs.version }}<\/Version>/' ./MacroDeck/MacroDeck.csproj | |
git add ./MacroDeck/MacroDeck.csproj | |
- name: Commit Changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Bump Version to ${{ needs.get-version.outputs.version }} | |
release-github: | |
name: "Release GitHub" | |
runs-on: ubuntu-latest | |
needs: [get-version, bump-version] | |
steps: | |
- name: "Create Release" | |
uses: Macro-Deck-App/Actions/create-github-release@main | |
id: create_release | |
with: | |
github-token: "${{ secrets.PAT }}" | |
is-beta: ${{ needs.get-version.outputs.is-beta }} | |
version: ${{ needs.get-version.outputs.version }} | |
target-commitish: ${{ needs.get-version.outputs.branch }} | |
create-pull-request: | |
name: "Create pull-request back to develop" | |
runs-on: ubuntu-latest | |
needs: [get-version, bump-version, release-github] | |
steps: | |
- name: Create Pull Request | |
if: ${{ needs.get-version.outputs.branch == 'main' }} | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
base: develop | |
branch: main | |
title: Bump Macro Deck version to ${{ needs.get-version.outputs.version }} | |
body: Bumps the version of Macro Deck to ${{ needs.get-version.outputs.version }} |