Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add workflow files #43

Merged
merged 6 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Checks and Linters

on:
push:

jobs:
security:
uses: lidofinance/linters/.github/workflows/security.yml@master

docker:
uses: lidofinance/linters/.github/workflows/docker.yml@master

actions:
uses: lidofinance/linters/.github/workflows/actions.yml@master
26 changes: 26 additions & 0 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Dev

on:
workflow_dispatch:
push:
branches:
- develop
paths-ignore:
- ".github/**"

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
name: Build and deploy
steps:
- name: Testnet deploy
uses: lidofinance/dispatch-workflow@v1
env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
TARGET_REPO: "lidofinance/infra-mainnet"
TARGET_WORKFLOW: "deploy_testnet_lido_content.yaml"
TARGET: "develop"
27 changes: 27 additions & 0 deletions .github/workflows/ci-preview-demolish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI Preview stand demolish

on:
workflow_dispatch:
pull_request:
types:
[converted_to_draft, closed]
branches-ignore:
- main

permissions: {}

jobs:
deploy:
runs-on: ubuntu-latest
name: Build and deploy
steps:
- name: Preview stand deploying
uses: lidofinance/dispatch-workflow@v1
env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
TARGET_REPO: "lidofinance/infra-mainnet"
TARGET: ${{ github.head_ref }}
TARGET_WORKFLOW: "preview_stand_demolish.yaml"
INPUTS_REPO_NAME: ${{ github.repository }}
INPUTS_PR_ID: ${{ github.event.pull_request.number }}
67 changes: 67 additions & 0 deletions .github/workflows/ci-preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI Preview stand deploy

on:
workflow_dispatch:
inputs:
inventory:
description: inventory to be used for preview stand deploying
default: staging-critical
required: false
type: choice
options:
- staging-critical
- testnet

pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches-ignore:
- main

permissions:
contents: read
pull-requests: write

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.draft == false }}
name: Build and deploy
outputs:
stand_url: ${{ steps.stand.outputs.url }}
steps:
- uses: lidofinance/gh-find-current-pr@v1
id: pr

- name: Set ref
id: ref
run: echo "short_ref=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Preview stand deploying
uses: lidofinance/dispatch-workflow@v1
env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
TARGET_REPO: "lidofinance/infra-mainnet"
TARGET: ${{ github.head_ref || steps.ref.outputs.short_ref }}
TARGET_WORKFLOW: "preview_stand_deploy.yaml"
INPUTS_REPO_NAME: ${{ github.repository }}
INPUTS_PR_ID: ${{ github.event.pull_request.number || steps.pr.outputs.number }}
INPUTS_INVENTORY: "${{ inputs.inventory || 'staging-critical' }}"

- name: Define repo short name
run: echo "short_name=$(echo ${{ github.repository }} | cut -d "/" -f 2)" >> $GITHUB_OUTPUT
id: repo

- name: Define branch hash
run: echo "hash=$(echo "$HEAD_REF" | shasum -a 256 | cut -c -10)" >> $GITHUB_OUTPUT
id: branch
env:
HEAD_REF: ${{ github.head_ref || steps.ref.outputs.short_ref }}

- name: Extract stand url
if: always()
run: echo "url=https://$SHORT_NAME-$BRANCH_HASH.branch-preview.org" >> $GITHUB_OUTPUT
id: stand
env:
SHORT_NAME: ${{ steps.repo.outputs.short_name }}
BRANCH_HASH: ${{ steps.branch.outputs.hash }}
25 changes: 25 additions & 0 deletions .github/workflows/ci-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI Build prod image

on:
release:
types: [released]

permissions: {}

jobs:
# test:
hexnickk4997 marked this conversation as resolved.
Show resolved Hide resolved
# ...

deploy:
runs-on: ubuntu-latest
# needs: test
name: Build and deploy
steps:
- name: Build prod image
uses: lidofinance/dispatch-workflow@v1
env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
TARGET_REPO: "lidofinance/infra-mainnet"
TAG: "${{ github.event.release.tag_name }}"
TARGET_WORKFLOW: "build_critical_lido_content.yaml"
26 changes: 26 additions & 0 deletions .github/workflows/ci-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Staging

on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- ".github/**"

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
name: Build and deploy
steps:
- name: Staging deploy
uses: lidofinance/dispatch-workflow@v1
env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
TARGET_REPO: "lidofinance/infra-mainnet"
TARGET_WORKFLOW: "deploy_staging_critical_lido_content.yaml"
TARGET: "main"
14 changes: 14 additions & 0 deletions .github/workflows/prepare-release-draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Prepare release draft
on:
push:
branches:
- main

permissions:
contents: write

jobs:
prepare-release-draft:
uses: lidofinance/actions/.github/workflows/prepare-release-draft.yml@main
with:
target: main
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test
on: pull_request

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
hexnickk4997 marked this conversation as resolved.
Show resolved Hide resolved
- name: Run lint
run: yarn lint
# - name: Run tests
# run: yarn test
Loading