Skip to content

Improve local dev

Improve local dev #212

Workflow file for this run

name: PR Build
on:
pull_request:
branches:
- master
jobs:
deskpro_app_test_and_build:
name: Test / Build
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git fetch --no-tags --depth=1 origin master
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prep local dev
run: |
touch ~/.gitconfig
mkdir ~/.ssh
git config --global user.name "$(git log -1 --pretty=format:%an)"
git config --global user.email "$(git log -1 --pretty=format:%ae)"
- name: Export PR Labels
id: extract_labels
run: echo "labels=$(jq -r '[.[] | .name] | join(",")' <<< '${{ toJson(github.event.pull_request.labels) }}')" >> $GITHUB_OUTPUT
- name: Lint, Test, Build, and Tag
uses: devcontainers/ci@v0.3
env:
LABELS: "${{ steps.extract_labels.outputs.labels }}"
with:
env: LABELS
runCmd: |
# Lint
pnpm run lint
pnpm tsc --noemit
# Test
pnpm test:coverage
# Build
pnpm run build
# Tag
if [ "$(git log -1 --pretty=format:%ae)" = "noreply@github.com" ]; then
echo "Skipping workflow run because previous commit was made by workflow."
exit 0
fi
## Get current version number
PREV_COMMIT=$(git log -1 --pretty=format:%H -- manifest.json)
VERSION=$(git show $PREV_COMMIT:manifest.json | grep version | head -n 1 | awk -F'"' '{print $4}')
## Get the commit message
MILESTONE=$(echo "$LABELS" | grep -E 'major-version|minor-version' | head -1)
echo "Current Version is $VERSION and the milestone is $MILESTONE"
if [[ "$MILESTONE" == "major-version" ]]; then
pnpm run bumpManifestVer major $VERSION
elif [[ "$MILESTONE" == "minor-version" ]]; then
pnpm run bumpManifestVer minor $VERSION
else
pnpm run bumpManifestVer patch $VERSION
fi
pnpm prettier --write manifest.json
- name: Package app zip
working-directory: dist
run: |
zip -rq ../app.zip *
mv ../app.zip .
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: app-package
path: |
dist/app.zip
dist/manifest.json
retention-days: 7
deploy:
uses: DeskproApps/app-template-vite/.github/workflows/subworkflow-deploy.yml@master
secrets: inherit
if: github.actor != 'dependabot[bot]'
needs: [deskpro_app_test_and_build]