Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Swap CI/CD from Travis to GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
solocommand committed Apr 15, 2024
1 parent 47b6189 commit 1156335
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 123 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Deploy suite (Production)

on:
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]

env:
ECR_REGISTRY: 598984531759.dkr.ecr.us-east-2.amazonaws.com
IMG_PREFIX: base-cms-services

jobs:
version:
runs-on: ubuntu-latest
steps:
- id: tag_version
run: |
REF=$(echo $GITHUB_REF | cut -d / -f 3)
[[ "$GITHUB_REF" =~ ^refs/tags.*$ ]] && VERSION="$REF" || VERSION="${REF}-${GITHUB_SHA::7}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.tag_version.outputs.version }}

notify-start:
needs: [version]
uses: parameter1/actions/.github/workflows/notify-start.yml@main
secrets: inherit
with:
version: ${{ needs.version.outputs.version }}

post-deploy-failure:
if: failure()
needs: [notify-start, build, deploy-2]
uses: parameter1/actions/.github/workflows/notify-fail.yml@main
secrets: inherit
with:
slack-thread: ${{ needs.notify-start.outputs.slack-thread }}

post-deploy-complete:
if: success()
needs: [notify-start, build, deploy-2]
uses: parameter1/actions/.github/workflows/notify-complete.yml@main
secrets: inherit
with:
slack-thread: ${{ needs.notify-start.outputs.slack-thread }}

build:
needs: [version]
runs-on: ubuntu-latest
strategy:
matrix:
service:
- google-data-api
- graphql-server
- hooks
- oembed
- omail-link-processor
- rss
- sitemaps
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v1
name: Login to ECR
with:
registry: ${{ env.ECR_REGISTRY }}
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Build docker image
uses: docker/build-push-action@v2
with:
context: .
file: services/${{ matrix.service }}/Dockerfile
push: true
build-args: |
SERVICE=${{ matrix.service }}
tags: ${{ env.ECR_REGISTRY }}/${{ env.IMG_PREFIX }}:${{ matrix.service }}-${{ needs.version.outputs.version }}

deploy-1:
needs: [version, build]
runs-on: ubuntu-latest
strategy:
matrix:
service:
- google-data-api
- oembed
- rss
- sitemaps
steps:
- name: Deploy to Kubernetes
run: |
npx @parameter1/rancher2cli dl \
--wait basecms-service ${{ matrix.service }} \
${{ env.ECR_REGISTRY }}/${{ env.IMG_PREFIX }}:${{ matrix.service }}-${{ needs.version.outputs.version }}
env:
RANCHER_CLUSTERID: ${{ secrets.RANCHER_CLUSTERID_BASECMS }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
RANCHER_URL: ${{ secrets.RANCHER_URL }}

deploy-2:
needs: [version, build, deploy-1]
runs-on: ubuntu-latest
strategy:
matrix:
service:
- graphql-server
- hooks
- omail-link-processor
steps:
- name: Deploy to Kubernetes
run: |
npx @parameter1/rancher2cli dl \
--wait basecms-service ${{ matrix.service }} \
${{ env.ECR_REGISTRY }}/${{ env.IMG_PREFIX }}:${{ matrix.service }}-${{ needs.version.outputs.version }}
env:
RANCHER_CLUSTERID: ${{ secrets.RANCHER_CLUSTERID_BASECMS }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
RANCHER_URL: ${{ secrets.RANCHER_URL }}
33 changes: 33 additions & 0 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 14.x

- uses: actions/cache@v4
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

- run: yarn test
123 changes: 0 additions & 123 deletions .travis.yml

This file was deleted.

0 comments on commit 1156335

Please sign in to comment.