Skip to content

fix: appshell host runtime configuration (#32) #140

fix: appshell host runtime configuration (#32)

fix: appshell host runtime configuration (#32) #140

Workflow file for this run

name: Appshell CI
on:
push:
branches:
- main
- develop
- 'feature/**'
- 'fix/**'
pull_request:
branches:
- main
- develop
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Lint
run: yarn lint
- name: Test
run: yarn test:ci
- name: Build
run: yarn build
publish_npm_packages:
needs: build
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
- name: Git Identity
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: $GITHUB_REPOSITORY
- name: Authenticate with Registry
run: |
yarn logout
echo "@appshell:registry=https://registry.npmjs.org/" > .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Version and tag pre-release
if: ${{ github.ref == 'refs/heads/develop' }}
run: npx lerna version --no-push --conventional-prerelease --yes
- name: Version and tag release
if: ${{ github.ref == 'refs/heads/main' }}
run: npx lerna version --no-push --conventional-graduate --yes
- name: Build
run: yarn build
- name: Publish
run: npx lerna publish --yes from-git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push CI commit
run: git push --follow-tags
push_docker_images:
name: Push Docker images to Docker Hub
needs: publish_npm_packages
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }}
runs-on: ubuntu-latest
strategy:
matrix:
package-dir: [react-host]
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Pull latest
run: git pull
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get the version
id: vars
run: echo "version=$(cat packages/${{ matrix.package-dir }}/package.json | grep \"version\" | sed 's/.*\://' | tr -d '", ')" >> $GITHUB_OUTPUT
- name: Build and push Docker production image
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
target: production
build-args: |
SOURCE_DIR=packages/${{ matrix.package-dir }}
tags: |
${{ secrets.DOCKER_ORG }}/${{ matrix.package-dir }}:latest
${{ secrets.DOCKER_ORG }}/${{ matrix.package-dir }}:${{ steps.vars.outputs.version }}
- name: Build and push Docker developer image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
target: developer
build-args: |
SOURCE_DIR=packages/${{ matrix.package-dir }}
tags: |
${{ secrets.DOCKER_ORG }}/${{ matrix.package-dir }}:developer
${{ secrets.DOCKER_ORG }}/${{ matrix.package-dir }}:${{ steps.vars.outputs.version }}-developer