Skip to content

upgrade dependencies #239

upgrade dependencies

upgrade dependencies #239

Workflow file for this run

name: Build
on:
push:
branches:
- main
permissions:
contents: write
issues: write
packages: write
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
jobs:
build-and-deploy:
environment:
# this environment is added here to provide a link to the design system on the GitHub project page
name: design-system
url: https://dhhyi.github.io/travel-packlist/index.design.html
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
# https://manski.net/articles/github/actions/dump-context
- name: Dump GitHub Context for Debugging 🪲
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- name: Install pnpm 📦
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js 📦
uses: actions/setup-node@v4
with:
node-version: 'latest'
cache: 'pnpm'
- name: Set up JDK 📦
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '21'
- name: Install Production Dependencies 📦
run: pnpm install --frozen-lockfile --prod
- name: Get Git Hashes
id: git
run: |
echo "hash0=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "hash1=$(git rev-parse HEAD~1)" >> $GITHUB_OUTPUT
echo "hash2=$(git rev-parse HEAD~2)" >> $GITHUB_OUTPUT
echo "hash3=$(git rev-parse HEAD~3)" >> $GITHUB_OUTPUT
echo "hash4=$(git rev-parse HEAD~4)" >> $GITHUB_OUTPUT
echo "hash5=$(git rev-parse HEAD~5)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Nx Cache
uses: actions/cache@v4
with:
key: nx-${{ runner.os }}-${{ steps.git.outputs.hash0 }}
path: .nx
restore-keys: |
nx-${{ runner.os }}-${{ steps.git.outputs.hash1 }}
nx-${{ runner.os }}-${{ steps.git.outputs.hash2 }}
nx-${{ runner.os }}-${{ steps.git.outputs.hash3 }}
nx-${{ runner.os }}-${{ steps.git.outputs.hash4 }}
nx-${{ runner.os }}-${{ steps.git.outputs.hash5 }}
- name: Build Applications 🔧
run: |
pnpm exec nx run-many \
--configuration ci \
-t build \
-p travel-packlist-android \
travel-packlist-web
env:
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEYSTORE_ALIAS_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_ALIAS_PASSWORD }}
- name: Install All Dependencies 📦
run: pnpm install --frozen-lockfile
- name: Check 🚦
env:
commits: ${{ toJson(github.event.commits) }}
run: |
noOfCommits=$(echo "$commits" | jq '. | length')
echo "running affected for $noOfCommits commits"
pnpm exec nx affected \
--configuration ci \
-t test,lint,format,tsconfiglint,build \
--base=HEAD~$noOfCommits \
--head=HEAD
- name: Check No Changes 🚦
run: git diff --exit-code
- name: Build Design System 🎨
run: |
pnpm exec nx run design-system:build --configuration ci
echo "::group::Move and Copy Design System Files"
mv dist/apps/design-system/index.html dist/apps/design-system/index.design.html
cp -Rfv dist/apps/design-system/* dist/web/
echo "::endgroup::"
- name: Dead-Code
continue-on-error: true
run: pnpm exec nx run-many --configuration ci -t dead-code
- name: Deploy GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist/web
branch: gh-pages
clean: false
- name: Set up Docker Buildx 🐳
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build E2E Docker Image 🐳
run: |
docker buildx build \
-t ghcr.io/dhhyi/travel-packlist-e2e:latest \
--label org.opencontainers.image.source=https://github.com/dhhyi/travel-packlist \
--label org.opencontainers.image.description="End-to-End Tests for Travel Packlist" \
--label org.opencontainers.image.title="Travel Packlist E2E" \
--cache-from type=registry,ref=ghcr.io/dhhyi/travel-packlist-e2e-cache \
--cache-to type=registry,ref=ghcr.io/dhhyi/travel-packlist-e2e-cache,mode=max \
-f apps/travel-packlist-e2e/Dockerfile \
-o type=docker \
.
- name: E2E Tests 🧪
run: |
docker run \
-v $(pwd)/apps/travel-packlist-e2e:/ws/apps/travel-packlist-e2e \
-e CI=true \
ghcr.io/dhhyi/travel-packlist-e2e:latest \
travel-packlist-e2e:e2e --configuration ci
- name: Package E2E Results 📦
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-results
path: apps/travel-packlist-e2e/dist
if-no-files-found: warn
include-hidden-files: true
- name: Check for Release 🧐
id: check_release
run: |
version=$(npm pkg get version | sed 's/"//g')
echo "version=$version" >> $GITHUB_OUTPUT
if [ "$(git rev-parse "v$version^0")" = "${{ github.sha }}" ]; then
echo "do_release=true" >> $GITHUB_OUTPUT
fi
cat $GITHUB_OUTPUT
- name: Build Release 🚀
if: steps.check_release.outputs.do_release == 'true'
env:
VERSION: ${{ steps.check_release.outputs.version }}
GH_TOKEN: ${{ github.token }}
run: |
mv dist/android/travel-packlist-debug.apk dist/android/travel-packlist-$VERSION.apk
mv dist/android/travel-packlist.aab dist/android/travel-packlist-$VERSION.aab
pnpm i --frozen-lockfile
pnpm release-notes RELEASE-NOTES.md
gh release create \
"v$VERSION" \
dist/android/travel-packlist-$VERSION.apk \
dist/android/travel-packlist-$VERSION.aab \
-t "Release $VERSION" \
-F RELEASE-NOTES.md
cat RELEASE-NOTES.md | grep -oE 'closes \[#([0-9]+)\]' | grep -oE '[0-9]+' \
| xargs -rI{} gh issue close {} -c "fixed in version [$VERSION](https://github.com/dhhyi/travel-packlist/releases/tag/v$VERSION)"
# 'closes' is the wording in the release notes
# for adding a reference in the commit just use the #number without
# anything that automatically closes the issue
# (https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)