Skip to content

Commit

Permalink
ci: refactor workflows to publish mainnet suffixed tags to Docker Hub
Browse files Browse the repository at this point in the history
Also improved the formatting
  • Loading branch information
rhyslbw committed Aug 25, 2021
1 parent dd031e3 commit 6fefeb9
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 50 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ jobs:
build:
runs-on: ubuntu-20.04
steps:
-
name: Checkout source code
- name: πŸ“₯ Checkout repository
uses: actions/[email protected]
-
name: Setup Node.js

- name: 🧰 Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: 🧰 Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Compile TypeScript and lint

- name: πŸ”¨ Compile TypeScript and lint
run: |
yarn install --offline --frozen-lockfile --non-interactive --logevel=error
yarn build
Expand All @@ -30,16 +29,16 @@ jobs:
ALLOW_INTROSPECTION: true
CACHE_ENABLED: false
CARDANO_GRAPHQL_VERSION: ${{ github.sha }}
-
name: Build Cardano GraphQL Dockerfile
- name: πŸ”¨ Build Cardano GraphQL Server Dockerfile
uses: docker/build-push-action@v2
with:
cache-from: type=registry,ref=inputoutput/cardano-graphql:master
cache-to: type=inline
tags: inputoutput/cardano-graphql:${{ github.sha }}
target: server
-
name: Build Cardano GraphQL Hasura Dockerfile
- name: πŸ”¨ Build Cardano GraphQL Hasura Dockerfile
uses: docker/build-push-action@v2
with:
context: ./packages/api-cardano-db-hasura/hasura
Expand Down
57 changes: 43 additions & 14 deletions .github/workflows/post_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,63 @@ on:

jobs:
push-docker-build:
runs-on: ubuntu-20.04
strategy:
matrix:
os: [ ubuntu-20.04 ]
network: [ "mainnet", "testnet", "alonzo-purple" ]

runs-on: ${{ matrix.os }}
steps:
-
name: Checkout source code
- name: πŸ“₯ Checkout repository
uses: actions/[email protected]
-
name: Set up Docker Buildx
- name: 🧰 Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to Docker Hub
- name: 🐳 Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
-
name: Build and push Cardano GraphQL Dockerfile

- name: πŸ“ Base Variables
id: base-variables
run: |
echo ::set-output name=cardano-graphql-server-image::inputoutput/cardano-graphql
echo ::set-output name=cardano-graphql-hasura-image::inputoutput/cardano-graphql-hasura
- name: πŸ”¨ Build and push Cardano GraphQL Server Dockerfile (default latest)
if: ${{ matrix.network == 'mainnet' }}
uses: docker/build-push-action@v2
with:
cache-from: type=registry,ref=inputoutput/cardano-graphql:master
build-args: NETWORK=${{ matrix.network }}
context: .
push: true
tags: ${{ steps.base-variables.outputs.cardano-graphql-server-image }}:latest
target: server
cache-from: type=registry,ref=${{ steps.base-variables.outputs.cardano-graphql-server-image }}:latest
cache-to: type=inline

- name: πŸ”¨ Build and push Cardano GraphQL Server Dockerfile (network latest)
uses: docker/build-push-action@v2
with:
build-args: NETWORK=${{ matrix.network }}
context: .
push: true
tags: inputoutput/cardano-graphql:${{ github.sha }}, inputoutput/cardano-graphql:master
tags: ${{ steps.base-variables.outputs.cardano-graphql-server-image }}:latest-${{ matrix.network }}
target: server
-
name: Build and push Cardano GraphQL Hasura Dockerfile
cache-from: type=registry,ref=${{ steps.base-variables.outputs.cardano-graphql-server-image }}:master-${{ matrix.network }}
cache-to: type=inline

- name: πŸ”¨ Build and push Cardano GraphQL Hasura Dockerfile (network latest)
uses: docker/build-push-action@v2
with:
build-args: NETWORK=${{ matrix.network }}
context: ./packages/api-cardano-db-hasura/hasura
file: ./packages/api-cardano-db-hasura/hasura/Dockerfile
push: true
tags: inputoutput/cardano-graphql-hasura:${{ github.sha }}, inputoutput/cardano-graphql-hasura:master
tags: ${{ steps.base-variables.outputs.cardano-graphql-hasura-image }}:latest-${{ matrix.network }}
target: server
cache-from: type=registry,ref=${{ steps.base-variables.outputs.cardano-graphql-hasura-image }}:master-${{ matrix.network }}
cache-to: type=inline

68 changes: 45 additions & 23 deletions .github/workflows/post_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,80 @@ on:

jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-20.04 ]
network: [ "mainnet", "testnet", "alonzo-purple" ]

runs-on: ${{ matrix.os }}
steps:
-
name: Checkout source code
- name: πŸ“₯ Checkout repository
uses: actions/[email protected]
-
name: Setup Node.js

- name: 🧰 Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: 🧰 Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to Docker Hub

- name: 🐳 Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
-
name: Build and push Cardano GraphQL Dockerfile

- name: πŸ“ Base Variables
id: base-variables
run: |
echo ::set-output name=cardano-graphql-server-image::inputoutput/cardano-graphql
echo ::set-output name=cardano-graphql-hasura-image::inputoutput/cardano-graphql-hasura
- name: πŸ”¨ Build and push Cardano GraphQL Server Dockerfile (default)
if: ${{ matrix.network == 'mainnet' }}
uses: docker/build-push-action@v2
with:
cache-from: type=registry,ref=${{ steps.base-variables.outputs.cardano-graphql-server-image }}:latest
cache-to: type=inline
push: true
tags: inputoutput/cardano-graphql:${{ github.sha }}, inputoutput/cardano-graphql:${{ github.event.release.tag_name }}, inputoutput/cardano-graphql:latest
cache-from: type=registry,ref=inputoutput/cardano-graphql:master
tags: ${{ steps.base-variables.outputs.cardano-graphql-server-image }}:${{ github.sha }}, ${{ steps.base-variables.outputs.cardano-graphql-server-image }}:${{ github.event.release.tag_name }}, ${{ steps.base-variables.outputs.cardano-graphql-server-image }}:latest
target: server

- name: πŸ”¨ Build and push Cardano GraphQL Server Dockerfile (network tags)
uses: docker/build-push-action@v2
with:
build-args: NETWORK=${{ matrix.network }}
cache-from: type=registry,ref=${{ steps.base-variables.outputs.cardano-graphql-server-image }}:latest
cache-to: type=inline
-
name: Build and push Cardano GraphQL Hasura Dockerfile
push: true
tags: ${{ steps.base-variables.outputs.cardano-graphql-server-image }}:${{ github.sha }}-${{ matrix.network }}, ${{ steps.base-variables.outputs.cardano-graphql-server-image }}:${{ github.event.release.tag_name }}-${{ matrix.network }}, ${{ steps.base-variables.outputs.cardano-graphql-server-image }}:latest-${{ matrix.network }}
target: server

- name: πŸ”¨ Build and push Cardano GraphQL Hasura Dockerfile
uses: docker/build-push-action@v2
with:
context: ./packages/api-cardano-db-hasura/hasura
file: ./packages/api-cardano-db-hasura/hasura/Dockerfile
push: true
tags: inputoutput/cardano-graphql-hasura:${{ github.sha }}, inputoutput/cardano-graphql-hasura:${{ github.event.release.tag_name }}, inputoutput/cardano-graphql-hasura:latest
-
name: Publish packages to npm registry
tags: ${{ steps.base-variables.outputs.cardano-graphql-hasura-image }}:${{ github.sha }}, inputoutput/cardano-graphql-hasura:${{ github.event.release.tag_name }}, inputoutput/cardano-graphql-hasura:latest

- name: πŸ“€ Publish packages to npm registry
run: |
yarn install --offline --frozen-lockfile --non-interactive --logevel=error
npx npm-cli-login -u ${{ secrets.NPM_REGISTRY_USER }} -e ${{ secrets.NPM_REGISTRY_EMAIL }} -p ${{ secrets.NPM_REGISTRY_TOKEN }}
scripts/publish_packages.sh
if: ${{ always() }}
rm -f .npmrc
-
name: Build docs
- name: πŸ”¨ Build docs
run: |
yarn --cwd ./docs install --frozen-lockfile
yarn --cwd ./docs build
env:
SKIP_PREFLIGHT_CHECK: true
-
name: Deploy
- name: πŸ“€ Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
Expand Down

0 comments on commit 6fefeb9

Please sign in to comment.