Skip to content

Commit

Permalink
infra: improve cicd workflow [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilevos committed Dec 14, 2023
1 parent 0405bc2 commit f791a4b
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 6 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/docker-ghostnet-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Docker ghostnet staging

on:
push:
branches:
- 'staging'
paths-ignore:
- 'docs/**'
pull_request:
branches:
- 'staging'
types:
- closed
paths-ignore:
- 'docs/**'
workflow_dispatch:

jobs:
ui:
strategy:
matrix:
network: [ghostnet]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
submodules: true

- name: Set outputs
id: vars
run: |
echo "date=$(date +%Y-%m-%dT%H-%M-%S)" >> "${GITHUB_OUTPUT}"
echo "sha_short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}"
- name: Set up Docker Buildx
uses: docker/Setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push version
uses: docker/build-push-action@v3
with:
file: ./Dockerfile.${{ matrix.network }}
context: ./
push: true
tags: |
ghcr.io/marigold-dev/gas-station-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-staging
cache-from: type=gha
cache-to: type=gha,mode=max
23 changes: 17 additions & 6 deletions .github/workflows/docker-ghostnet.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name: Docker ghostnet

on:
push:
push: # to remove
branches:
- 'release-ghostnet'
- 'main' # Remove this line when we want more controlled releases
- 'main'
paths-ignore:
- 'docs/**'
pull_request:
pull_request: # to remove
branches:
- 'release-ghostnet'
types:
- closed
paths-ignore:
- 'docs/**'
repository_dispatch:
types: [from-release-coord-repo]
workflow_dispatch:

jobs:
Expand All @@ -25,6 +29,14 @@ jobs:
with:
submodules: true

- if: github.event_name == 'repository_dispatch'
run: |
VERSION=${{ toJson(github.event.client_payload.version) }}
echo "VERSION=-$VERSION" >> $GITHUB_ENV
echo "Pipeline has been triggered through HTTP. Setting version to $VERSION."
env:
VERSION: ${{ toJson(github.event.client_payload.version) }}

- name: Set outputs
id: vars
run: |
Expand All @@ -41,15 +53,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push release version
- name: Build and push version
uses: docker/build-push-action@v3
with:
file: ./Dockerfile.${{ matrix.network }}
context: ./
push: true
tags: |
ghcr.io/marigold-dev/gas-station-api-${{ matrix.network }}:stable
ghcr.io/marigold-dev/gas-station-api-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release
ghcr.io/marigold-dev/gas-station-api-${{ matrix.network }}:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }}-release${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit f791a4b

Please sign in to comment.