Release #139
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
next_version: | |
default: "0.0.0" | |
description: "The next version to be released" | |
required: false | |
stable: | |
default: false | |
description: "Is this version stable?" | |
type: boolean | |
required: false | |
jobs: | |
update-changelog: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CI_PAT }} | |
fetch-depth: 0 | |
- name: Get flutter version | |
run: | | |
FLUTTER_VERSION=$(cat FLUTTER_VERSION) | |
echo "FLUTTER_VERSION=${FLUTTER_VERSION}" >> $GITHUB_ENV | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: 'master' | |
- name: Setup git | |
id: setup | |
run: | | |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)" | |
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]] | |
BUTTERFLY_VERSION="${BASH_REMATCH[1]}" | |
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV | |
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}" | |
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV | |
git config --global user.email "[email protected]" | |
git config --global user.name "Linwood CI" | |
- name: Update changelog | |
run: | | |
git fetch | |
git pull origin | |
dart pub get -C tools | |
dart run tools/set_version.dart --build-number keep ${{ env.BUTTERFLY_VERSION }} --changelog | |
git add . | |
git commit -m "Add changelog of v${{ env.BUTTERFLY_VERSION }}" | |
git push origin | |
- name: Merge in develop | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
git fetch | |
git checkout develop | |
git pull origin develop | |
git merge main --strategy-option ours | |
git push origin develop | |
release: | |
runs-on: ubuntu-22.04 | |
needs: | |
- update-changelog | |
outputs: | |
version: ${{ steps.setup.outputs.BUTTERFLY_VERSION }} | |
build_number: ${{ steps.setup.outputs.BUTTERFLY_BUILD_NUMBER }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CI_PAT }} | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- name: Get flutter version | |
run: | | |
FLUTTER_VERSION=$(cat FLUTTER_VERSION) | |
echo "FLUTTER_VERSION=${FLUTTER_VERSION}" >> $GITHUB_ENV | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: 'master' | |
- name: Setup git | |
id: setup | |
shell: bash | |
run: | | |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)" | |
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]] | |
BUTTERFLY_VERSION="${BASH_REMATCH[1]}" | |
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV | |
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_OUTPUT | |
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}" | |
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV | |
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_OUTPUT | |
git config --global user.email "[email protected]" | |
git config --global user.name "Linwood CI" | |
- name: Create tag | |
run: | | |
BUTTERFLY_VERSION="${{ env.BUTTERFLY_VERSION }}" | |
git tag -fa v${{ env.BUTTERFLY_VERSION }} -m "Release ${BUTTERFLY_VERSION}" | |
git push origin v${BUTTERFLY_VERSION} -f | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CI_PAT }} | |
fetch-depth: 0 | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: ${{ github.event.inputs.stable != 'true' }} | |
tag_name: v${{ env.BUTTERFLY_VERSION }} | |
name: v${{ env.BUTTERFLY_VERSION }} | |
token: ${{ secrets.CI_PAT }} | |
body_path: fastlane/metadata/android/en-US/changelogs/${{ env.BUTTERFLY_BUILD_NUMBER }}.txt | |
- name: Retag stable | |
if: ${{ github.event.inputs.stable == 'true' || github.ref == 'refs/heads/main' }} | |
run: | | |
git tag -fa stable -m "Find all stable releases here" | |
git push origin HEAD:stable -f | |
- name: Retag nightly | |
if: ${{ github.event.inputs.stable != 'true' && github.ref == 'refs/heads/develop' }} | |
run: | | |
git tag -fa nightly -m "Find all nightly releases here" | |
git push origin HEAD:nightly -f | |
- name: Merge in main | |
if: ${{ github.ref == 'refs/heads/develop' && github.event.inputs.stable == 'true' }} | |
run: | | |
git fetch | |
git checkout main | |
git pull origin main | |
git merge develop --strategy-option ours | |
git push origin main | |
set-next-version: | |
runs-on: ubuntu-22.04 | |
needs: | |
- update-changelog | |
- release | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CI_PAT }} | |
fetch-depth: 0 | |
- name: Get flutter version | |
run: | | |
FLUTTER_VERSION=$(cat FLUTTER_VERSION) | |
echo "FLUTTER_VERSION=${FLUTTER_VERSION}" >> $GITHUB_ENV | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: 'master' | |
- name: Setup git | |
id: setup | |
run: | | |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)" | |
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]] | |
BUTTERFLY_VERSION="${BASH_REMATCH[1]}" | |
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV | |
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}" | |
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV | |
git config --global user.email "[email protected]" | |
git config --global user.name "Linwood CI" | |
- name: Set next version | |
run: | | |
git fetch | |
git pull origin | |
dart pub get -C tools | |
dart run tools/set_version.dart --build-number increment ${{ github.event.inputs.next_version }} --no-changelog | |
git add . | |
git commit -m "Update Version to ${{ github.event.inputs.next_version }}" | |
git push origin | |
- name: Merge develop | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
git fetch | |
git checkout develop | |
git pull origin develop | |
git merge main --strategy-option ours | |
git push origin develop | |
bump-version: | |
runs-on: ubuntu-22.04 | |
needs: | |
- update-changelog | |
- release | |
- set-next-version | |
steps: | |
- name: Checkout main | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CI_PAT }} | |
fetch-depth: 0 | |
ref: main | |
- name: Checkout develop | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CI_PAT }} | |
fetch-depth: 0 | |
ref: develop | |
- name: Setup git | |
id: setup | |
run: | | |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)" | |
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]] | |
BUTTERFLY_VERSION="${BASH_REMATCH[1]}" | |
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV | |
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}" | |
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV | |
git config --global user.email "[email protected]" | |
git config --global user.name "Linwood CI" | |
- name: Get flutter version | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
run: | | |
FLUTTER_VERSION=$(cat app/FLUTTER_VERSION) | |
echo "FLUTTER_VERSION=${FLUTTER_VERSION}" >> $GITHUB_ENV | |
- name: Get flutter version | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
FLUTTER_VERSION=$(cat FLUTTER_VERSION) | |
echo "FLUTTER_VERSION=${FLUTTER_VERSION}" >> $GITHUB_ENV | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: 'master' | |
- name: Bump version | |
run: | | |
git fetch | |
git pull origin | |
dart pub get -C tools | |
dart run tools/set_version.dart --build-number increment ${{ env.BUTTERFLY_VERSION }} --no-changelog | |
git add . | |
git commit -m "Bump version" | |
git push origin | |
- name: Update develop | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
run: | | |
git fetch | |
git checkout develop | |
git pull origin | |
git merge main --strategy-option ours | |
git push origin develop | |
notify: | |
runs-on: ubuntu-22.04 | |
needs: [release] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CI_PAT }} | |
- name: Get information | |
shell: bash | |
run: | | |
BUTTERFLY_VERSION_REGEX="version:\s(.+)\+(.+)" | |
[[ $(grep -E "${BUTTERFLY_VERSION_REGEX}" app/pubspec.yaml) =~ ${BUTTERFLY_VERSION_REGEX} ]] | |
BUTTERFLY_VERSION="${BASH_REMATCH[1]}" | |
echo "BUTTERFLY_VERSION=${BUTTERFLY_VERSION}" >> $GITHUB_ENV | |
BUTTERFLY_BUILD_NUMBER="${BASH_REMATCH[2]}" | |
echo "BUTTERFLY_BUILD_NUMBER=${BUTTERFLY_BUILD_NUMBER}" >> $GITHUB_ENV | |
echo 'BUTTERFLY_CHANGELOG<<EOF' >> $GITHUB_ENV | |
cat fastlane/metadata/android/en-US/changelogs/${BUTTERFLY_BUILD_NUMBER}.txt >> $GITHUB_ENV | |
echo '' >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Discord Webhook Action | |
uses: tsickert/[email protected] | |
if: ${{ github.event.inputs.stable == 'true' || github.ref == 'refs/heads/main' }} | |
with: | |
webhook-url: ${{ secrets.WEBHOOK_URL }} | |
embed-title: ${{ env.BUTTERFLY_VERSION }} | |
embed-description: ${{ env.BUTTERFLY_CHANGELOG }} | |
embed-url: https://github.com/LinwoodDev/butterfly/releases/tag/v${{ env.BUTTERFLY_VERSION }} | |
content: | | |
Version ${{ env.BUTTERFLY_VERSION }} released! | |
Download it here: https://docs.butterfly.linwood.dev/downloads | |
https://github.com/LinwoodDev/butterfly/releases/tag/v${{ env.BUTTERFLY_VERSION }} | |
- name: Discord Webhook Action | |
uses: tsickert/[email protected] | |
if: ${{ github.event.inputs.stable == 'false' && github.ref == 'refs/heads/develop' }} | |
with: | |
webhook-url: ${{ secrets.WEBHOOK_URL }} | |
embed-title: ${{ env.BUTTERFLY_VERSION }} | |
embed-description: ${{ env.BUTTERFLY_CHANGELOG }} | |
embed-url: https://github.com/LinwoodDev/butterfly/releases/tag/v${{ env.BUTTERFLY_VERSION }} | |
content: | | |
Pre-release version ${{ env.BUTTERFLY_VERSION }} released! | |
Download it here: https://docs.butterfly.linwood.dev/downloads | |
Please note that this is a pre-release version and is not intended for production use. | |
Read more about it here: https://docs.butterfly.linwood.dev/nightly |