Skip to content

chore: initial_build #3

chore: initial_build

chore: initial_build #3

Workflow file for this run

name: Main - 🚀 build package
on:
push:
branches:
- main
jobs:
version:
name: Version & Build
runs-on: macos-latest
environment: release
permissions:
contents: write
outputs:
version: ${{ steps.get_new_version.outputs.result}}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{secrets.ELEVATED_TOKEN}}
- name: 📇 Configure git
run: |
git fetch --prune --unshallow
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
shell: bash
# Retrieve the new version
- name: 🔂 Run standard-version
uses: actions/github-script@v7
with:
script: |
const {execSync} = require('child_process');
execSync('npx standard-version --skip.tag', {stdio: 'inherit'});
# Retrieve the new version
- name: ⏎ Get new version
uses: actions/github-script@v7
id: get_new_version
with:
result-encoding: string
script: |
const fs = require('fs');
const package = JSON.parse(fs.readFileSync('package.json', 'utf8'));
return package.version;
- name: Print new version
run: echo ${{ steps.get_new_version.outputs.result}}
# Bump the pubspec.yaml file
- name: ⬆️ Bump pubspec.yaml
uses: emdgroup/mtrust-urp/.github/actions/update-pubspec@main
with:
version: ${{ steps.get_new_version.outputs.result }}
directory: .
- name: 📝 Update version in readme
uses: emdgroup/mtrust-urp/.github/actions/update-pubspec-readme-version@main
with:
directory: .
- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Prepare Flutter
uses: emdgroup/mtrust-urp/.github/actions/prepare-flutter@main
with:
directory: "."
- name: Validate Flutter
uses: emdgroup/mtrust-urp/.github/actions/validate-flutter@main
with:
directory: "."
is_package: true
- name: Check licenses
uses: emdgroup/mtrust-urp/.github/actions/check-dart-licenses@main
with:
directory: "."
# We first commit with proper message and add an empty commit to keep the files history clean
- name: Update repo versions
run: |
git add .
git commit -m "chore(release): ${{ steps.get_new_version.outputs.result }}"
git commit --allow-empty -m "chore(release): ${{ steps.get_new_version.outputs.result }} [skip ci]"
git push origin main
# For this part it is important to not push a commit with [skip ci] before the tag release
- name: Push tag for pub.dev
run: |
git commit --allow-empty -m "chore(release): ${{ steps.get_new_version.outputs.result }}"
git tag -a v${{ steps.get_new_version.outputs.result }} -m "Pub.dev version ${{ steps.get_new_version.outputs.result }}"
git push origin v${{ steps.get_new_version.outputs.result }}
rebase_dev:
name: Write changes to dev branch
needs: [version]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{secrets.ELEVATED_TOKEN}}
- name: Setup Git User
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Update Test Branch
run: |
git checkout main
git fetch origin
git checkout dev
git pull
git merge origin/main
git push origin dev