This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
Configure Renovate #295
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: 'Build/test/deploy' | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request_target: | |
types: [opened, synchronize, reopened, ready_for_review] | |
jobs: | |
quality-checks: | |
name: Quality Checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout for pull_request_target | |
uses: actions/checkout@v3 | |
if: ${{ github.event_name == 'pull_request_target' }} | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Normal checkout | |
uses: actions/checkout@v3 | |
if: ${{ github.event_name != 'pull_request_target' }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '12' | |
registry-url: 'https://npm.pkg.github.com/' | |
scope: '@cinch-labs' | |
- name: Restore node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: 'node_modules' | |
key: v1-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
run: yarn | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GHP_TOKEN }} | |
- name: Lint | |
run: yarn lint:check | |
- name: Prettier Check | |
run: yarn prettier:check | |
- name: Compile TypeScript | |
run: yarn build | |
- name: Package action | |
run: yarn package | |
- name: Unit tests | |
run: yarn test | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
env: | |
TEST_INFIX: sheepdog-${{ github.run_number }} | |
steps: | |
- name: Checkout for pull_request_target | |
uses: actions/checkout@v3 | |
if: ${{ github.event_name == 'pull_request_target' }} | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Normal checkout | |
uses: actions/checkout@v3 | |
if: ${{ github.event_name != 'pull_request_target' }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '12' | |
registry-url: 'https://npm.pkg.github.com/' | |
scope: '@cinch-labs' | |
- name: Restore node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: 'node_modules' | |
key: v1-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
run: yarn | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GHP_TOKEN }} | |
- name: Build & package | |
run: yarn build && yarn package | |
- name: Adding an infix | |
uses: ./ | |
with: | |
auth-authority: ${{ secrets.AUTH_AUTHORITY }} | |
access-key: ${{ secrets.ACCESS_KEY }} | |
subdomain-infix: ${{ env.TEST_INFIX }} | |
- name: Removing an infix | |
uses: ./ | |
with: | |
auth-authority: ${{ secrets.AUTH_AUTHORITY }} | |
access-key: ${{ secrets.ACCESS_KEY }} | |
subdomain-infix: ${{ env.TEST_INFIX }} | |
update-type: remove | |
build-deploy: | |
name: Build & Deploy | |
runs-on: ubuntu-latest | |
needs: [quality-checks, integration-tests] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '12' | |
registry-url: 'https://npm.pkg.github.com/' | |
scope: '@cinch-labs' | |
- name: Restore node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: 'node_modules' | |
key: v1-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
run: yarn | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GHP_TOKEN }} | |
- name: Build & package | |
run: yarn build && yarn package | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: Deploy Bot | |
author_email: deploy-bot@cinch.co.uk | |
message: 'Builds and deploy latest changes' |