Skip to content

Release

Release #39

on:
workflow_dispatch:
name: Release
jobs:
build:
name: Semantic-Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# - run: echo "1.0.0+1" > .version # this file seems to be required for the dry-mode
# Go Semantic Release
- name: Run Semantic Release
uses: go-semantic-release/action@v1
id: semrel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
changelog-file: CHANGELOG.md
changelog-generator-opt: "emojis=true"
force-bump-patch-version: true
dry: true # this will put the new version only in the '.version-unreleased' file.
# update-file: .version
- name: Set up Git
if: steps.semrel.outputs.version != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
- name: Update pubspec.yaml
if: steps.semrel.outputs.version != ''
run: | # use '.version-unreleased' if in dry-mode
echo "Version Release: ${{ steps.semrel.outputs.version }}"
echo "Changelog: ${{ steps.semrel.outputs.changelog }}"
echo "Version Unreleased: $(cat .version-unreleased)"
echo "CHANGELOG.md: $(cat CHANGELOG.md)"
./.github/scripts/updateVersion.sh "${{ steps.semrel.outputs.version }}"
- name: Restore Keystore
run: |
echo "${{ secrets.KEYSTORE }}" > sound-on-fire.jks.asc
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch sound-on-fire.jks.asc > android/sound-on-fire.jks
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.6'
channel: "stable" # or: 'dev' or 'beta'
- name: Prepare & Build
id: prepare-build
run: |
./.github/scripts/buildAndroid.sh release "${{ secrets.KEYSTORE_PASSWORD }}" "${{ secrets.KEY_PASSWORD }}" "${{ secrets.KEY_ALIAS }}" "${{ secrets.APP_CENTER_SECRET }}"
echo "artifact-filepath=$(cat tmp_artifact_path.txt)" >> $GITHUB_OUTPUT
echo "artifact-filename=$(cat tmp_artifact_name.txt)" >> $GITHUB_OUTPUT
echo "artifact-filepath-latest=$(cat tmp_artifact_path_latest.txt)" >> $GITHUB_OUTPUT
echo "artifact-filename-latest=$(cat tmp_artifact_name_latest.txt)" >> $GITHUB_OUTPUT
- name: Update In-App Update Config
id: update-config
run: |
./.github/scripts/updateAppChangelog.sh ${{ steps.create-release-version.outputs.upload_url }}
git add pubspec.yaml app-update-changelog.json CHANGELOG.md
git commit -m "chore(version): update release output"
git push
- name: Push tag
id: tag
if: steps.semrel.outputs.version != ''
run: |
appVersionName=$(cat pubspec.yaml | grep "version: " | cut -d ' ' -f2 | cut -d '+' -f1)
appVersionCode=$(cat pubspec.yaml | grep "version: " | cut -d ' ' -f2 | cut -d '+' -f2)
echo "Version: $appVersionName"
echo "Version-Code: $appVersionCode"
TAG="v$appVersionName+$appVersionCode"
echo "name=$TAG" >> $GITHUB_OUTPUT
git push origin :refs/tags/${TAG}
git push origin :refs/tags/latest
git tag ${TAG}
git tag latest
git push origin ${TAG}
git push origin latest
- name: Create Release Version
id: create-release-version
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.tag.outputs.name }}
name: Release ${{ steps.tag.outputs.name }}
draft: false
prerelease: false
body: ${{ steps.semrel.outputs.changelog }}
files: ${{ steps.prepare-build.outputs.artifact-filepath }}
- name: Create Release Latest
id: create-release-latest
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: latest
name: Latest release
draft: false
prerelease: false
files: ${{ steps.prepare-build.outputs.artifact-filepath-latest }}
- name: Upload to App Center
uses: wzieba/AppCenter-Github-Action@v1
with:
appName: timo_knapp/SoundOnFire
token: ${{secrets.APP_CENTER_API_TOKEN}}
group: public
file: ${{ steps.prepare-build.outputs.artifact-filepath }}