Skip to content

Commit

Permalink
feat: implemented release and deploy on main commit (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpoltorak-io committed Mar 3, 2023
1 parent bf4a27b commit cf0e2bc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,14 @@ jobs:
- name: Build website
run: |
yarn build --out-dir infra/website
release:
if: github.event_name == 'push' && !contains(github.event.head_commit.message, 'chore(release)')
uses: ./.github/workflows/release.yml
secrets: inherit
deploy:
if: startsWith(github.ref, 'refs/tags') && contains(github.event.head_commit.message, 'chore(release)')
uses: ./.github/workflows/deployment.yml
with:
version: "${{ github.ref_name }}"
env: "staging"
secrets: inherit
45 changes: 45 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deployment

# Trigger deployment when a new tag is pushed
# to a service component
on:
workflow_call:
inputs:
version:
required: true
type: string
env:
required: false
type: string
default: "staging"
workflow_dispatch:
inputs:
version:
description: "Version to deploy, e.g. v1.0.0"
required: true
env:
description: "Environment to trigger update on"
required: false
default: "staging"

jobs:
trigger-deployment:
runs-on: ubuntu-latest
steps:
- name: Parse input parameters
id: parse-params
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "VERSION=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
echo "ENV=${{ github.event.inputs.env }}" >> "${GITHUB_OUTPUT}"
else
echo "VERSION=${{ inputs.version }}" >> "${GITHUB_OUTPUT}"
echo "ENV=${{ inputs.env }}" >> "${GITHUB_OUTPUT}"
fi
- name: Trigger deployment
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.ATALA_GITHUB_TOKEN }}
repository: input-output-hk/atala-prism-non-prod-argocd-state
event-type: trigger-prism-documentation-deployment
client-payload: '{"version": "${{ steps.parse-params.outputs.VERSION }}", "env": "${{ steps.parse-params.outputs.ENV }}"}'
2 changes: 1 addition & 1 deletion atala-prism-building-blocks

0 comments on commit cf0e2bc

Please sign in to comment.