test: golden tests (#5) #7
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: Dev - 🚧 build package | |
on: | |
push: | |
branches: | |
- dev | |
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 --prerelease', {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 dev | |
# 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 }} |