Skip to content

Commit

Permalink
Merge pull request #2705 from Sifchain/feature/workflows
Browse files Browse the repository at this point in the history
[ChainOps] Workflow updates
  • Loading branch information
intl-man authored May 12, 2022
2 parents a022431 + 37ed45b commit 3c8740e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 101 deletions.
69 changes: 9 additions & 60 deletions .github/workflows/peggy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,15 @@ on:
- 'future/peggy2'

jobs:
build:
dispatch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get commit hash
id: hash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Build docker images
working-directory: docs/peggy
run: |
docker build -t sifchain/peggy-docs:${{ steps.hash.outputs.sha_short }} .
- name: Push docker images
run: |
docker push sifchain/peggy-docs:${{ steps.hash.outputs.sha_short }}
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: actions/github-script@v6
with:
repository: Sifchain/sifchain-devops
path: sifchain-devops
token: "${{ secrets.GIT_PAT }}"

- name: Get commit hash
id: hash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Configure AWS Credentials
working-directory: sifchain-devops
run: |
AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
AWS_REGION=${{ secrets.AWS_REGION }} \
AWS_ROLE=${{ secrets.AWS_ROLE }} \
PROFILE=sifchain-aws-sifchain-data \
make provider-aws-configure
- name: Generate kubernetes config
working-directory: sifchain-devops
run: |
CLUSTER_NAME=sifchain-aws-sifchain-data \
AWS_REGION=${{ secrets.AWS_REGION }} \
AWS_PROFILE=sifchain-aws-sifchain-data \
AWS_ROLE=${{ secrets.AWS_ROLE }} \
make provider-aws-kubeconfig
- name: Deploy peggy docs
working-directory: sifchain-devops
run: |
helm upgrade peggy-docs helm/standalone/peggy-docs --install -n peggy-docs \
--create-namespace \
--set image.tag=${{ steps.hash.outputs.sha_short }}
github-token: ${{ secrets.GIT_PAT }}
script: |
await github.rest.actions.createWorkflowDispatch({
repo: 'sifchain/sifchain-chainops',
workflow_id: 'peggy-deploy-docs-peggy-2.yml',
ref: 'main'
})
56 changes: 15 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,22 @@ on:
- published

jobs:
release:
name: Release
dispatch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: Sifchain/sifchain-devops
path: sifchain-devops
token: "${{ secrets.GIT_PAT }}"

- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get version
id: version
run: |
echo "::set-output name=version::$(cat version)"
- name: Build docker images
run: |
make IMAGE_TAG=${{ steps.version.outputs.version }} BINARY=sifnoded build-image
make IMAGE_TAG=${{ steps.version.outputs.version }} BINARY=ebrelayer build-image
- name: Push docker images
run: |
docker push sifchain/sifnoded:${{ steps.version.outputs.version }}
docker push sifchain/ebrelayer:${{ steps.version.outputs.version }}
- name: Get commit hash
id: hash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get the tag
id: release_tag
run: echo ::set-output name=name::${GITHUB_REF/refs\/tags\//}

- name: Release a new sifnoded binary
uses: ./sifchain-devops/release
- uses: actions/github-script@v6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: amd64
goversion: "1.17"
project_path: "./cmd/sifnoded"
binary_name: "sifnoded"
ldflags: "-X github.com/cosmos/cosmos-sdk/version.Name=sifchain -X github.com/cosmos/cosmos-sdk/version.ServerName=sifnoded -X github.com/cosmos/cosmos-sdk/version.ClientName=sifnoded -X github.com/cosmos/cosmos-sdk/version.Version=${{ steps.version.outputs.version }} -X github.com/cosmos/cosmos-sdk/version.Commit=${{ steps.hash.outputs.sha_short }}"
sha256sum: true
github-token: ${{ secrets.GIT_PAT }}
script: |
await github.rest.actions.createWorkflowDispatch({
repo: 'sifchain/sifchain-chainops',
workflow_id: 'sifnode-release.yml',
ref: 'main',
inputs: {
release_tag: ${{ steps.release_tag.outputs.name }}
}
})

0 comments on commit 3c8740e

Please sign in to comment.