name: Release on: workflow_dispatch: # TODO: During development, it's good to have daily releases. # This should be adjusted to a regular deployment window later. schedule: - cron: '15 14 * * *' jobs: version: name: Release runs-on: ubuntu-20.04 steps: - name: Git mail run: git config --global user.email "kitt@amazee.com" - name: Git username run: git config --global user.name "K.I.T.T." - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.1' - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 ref: dev - name: Read .nvmrc run: | echo "##[set-output name=NODE_VERSION;]$(cat .nvmrc| grep -oE '[0-9]+(\.[0-9]+)?(\.[0-9]+)?' | head -1)" id: node_version - name: Setup Node.js uses: actions/setup-node@v2 with: node-version: | {{'${{ steps.node_version.outputs.NODE_VERSION }}'}} - name: Tell yarn to use bash run: yarn config set script-shell /bin/bash - name: Get Yarn cache directory id: yarn-cache run: echo "::set-output name=dir::$(yarn cache dir)" - name: Get Yarn version hash id: yarn-version run: | echo "::set-output name=hash::$(yarn --version | shasum | cut -d' ' -f1)" - name: Get Composer cache directory id: composer-cache run: | echo "::set-output name=dir::$(composer global config cache-files-dir)" - name: Get Composer version hash id: composer-version run: | echo "::set-output name=hash::$(composer --version | shasum | cut -d' ' -f1)" - name: Cache dependencies uses: actions/cache@v2 env: cache-name: cache-dependencies with: path: | {{'${{ steps.yarn-cache.outputs.dir }}'}} {{'${{ steps.composer-cache.outputs.dir }}'}} key: | {{'${{ runner.os }}-yarn-${{ steps.yarn-version.outputs.hash }}-composer-${{ steps.composer-version.outputs.hash }}-github_run_id-${{ github.run_id }}'}} restore-keys: | {{'${{ runner.os }}-yarn-${{ steps.yarn-version.outputs.hash }}-composer-${{ steps.composer-version.outputs.hash }}-'}} - name: Install dependencies run: yarn install --frozen-lockfile - name: Run static tests run: yarn test:static - name: Run unit tests run: yarn test:unit - name: Run integration tests run: yarn test:integration - name: Check for uncommitted changes run: | if [[ $(git status --porcelain) ]] then echo "Error: Found uncommitted changes. Lerna publish will fail." git status --porcelain git diff false else echo "Success: Found no uncommitted changes" fi - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: yarn lerna version -y - name: Merge dev -> prod uses: devmasx/merge-branch@1.4.0 with: type: now target_branch: prod github_token: ${{ github.token }}