fix: Update section symbol #1893
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Read .nvmrc | |
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV | |
- name: Set Nodejs version ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: yarn | |
- name: restore-yarn-cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
- name: npm install | |
run: | | |
node -v | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn install --frozen-lockfile | |
test: | |
runs-on: ubuntu-latest | |
needs: install | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Read .nvmrc | |
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV | |
- name: Set Nodejs version ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: yarn | |
- name: print job details | |
run: | | |
echo "github_ref ${{ github.ref }}" | |
echo "github_event_name ${{ github.event_name }}" | |
echo "node version ${{ env.NODE_VERSION }}" | |
- name: restore-yarn-cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
- name: npm install | |
run: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn install --frozen-lockfile | |
- name: lint | |
run: yarn lint | |
- name: jest test | |
run: yarn test | |
- name: test build | |
run: yarn build | |
# snapshot-test: | |
# runs-on: ubuntu-latest | |
# needs: install | |
# steps: | |
# # Checkout the repo | |
# - uses: actions/checkout@v2 | |
# with: | |
# ref: ${{ github.head_ref }} | |
# - name: run snapshot tests | |
# run: | | |
# ./scripts/docker/snapshot-test/prepare.sh | |
# ./scripts/docker/snapshot-test/run-tests.sh | |
# - name: save snapshots | |
# if: failure() | |
# uses: actions/upload-artifact@v1 | |
# with: | |
# name: bitmaps_reference | |
# path: backstop_data/bitmaps_reference | |
deploy: | |
runs-on: ubuntu-latest | |
# needs: [install, test, snapshot-test] | |
needs: [install, test] | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Read .nvmrc | |
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV | |
- name: Set Nodejs version ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: yarn | |
- name: generate hash | |
run: | | |
HASH=$(date | md5sum | cut -d ' ' -f 1) | |
ZIP_FILE_NAME="storybook---$HASH" | |
echo "HASH=$HASH" >> $GITHUB_ENV | |
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV | |
- name: install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install -y qemu-user-static binfmt-support | |
- name: build docker image | |
run: | | |
echo "zipFileName ${{ env.ZIP_FILE_NAME }}" | |
zipFileName=${{ env.ZIP_FILE_NAME }} | |
/bin/bash ./scripts/docker/export-prod.sh $zipFileName | |
echo "Docker image is $(du -h docker-image.tar)" | |
- name: deploy | |
run: | | |
zipFileName=${{ env.ZIP_FILE_NAME }} | |
zip -r $zipFileName.zip docker-image.tar meta.json | |
echo "Zip file is $(du -h $zipFileName.zip)" | |
echo "${{ secrets.EC2_RSA }}" > ./identityFile.txt | |
chmod 400 ./identityFile.txt | |
scp -o "StrictHostKeyChecking=no" -i ./identityFile.txt -r ./$zipFileName.zip ubuntu@ec2-13-40-134-151.eu-west-2.compute.amazonaws.com:/home/ubuntu/departure-lounge/ | |
release: | |
runs-on: ubuntu-latest | |
# needs: [test, snapshot-test] | |
needs: [install, test] | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- name: Read .nvmrc | |
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV | |
- name: Set Nodejs version ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: yarn | |
- name: restore-yarn-cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} | |
# We use a fresh checkout here so that we can authenticate with a personal access token. | |
# This allows us to push new commits to a protected branch, which we cannot do with default GH action token. | |
- name: Pull git repo | |
run: | | |
git config --global user.name "GitHub Actions Bot" | |
git config --global user.email "<>" | |
git config --global credential.helper cache | |
git clone https://${{secrets.PUBLISH_GH_TOKEN}}@github.com/georgegillams/components | |
mv node_modules components/ | |
- name: npm install | |
run: | | |
cd components | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn install --frozen-lockfile | |
- name: release | |
env: | |
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
run: | | |
cd components | |
npm config set //registry.npmjs.org/:_authToken $NPM_PUBLISH_TOKEN | |
yarn release |