Rollback Frontends (Previous Commit) #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rollback Frontends (Previous Commit) | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: 'Environment' | |
options: | |
- 'mainnet' | |
network: | |
type: choice | |
description: 'Network' | |
options: | |
- 'fluidity' | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
rollback-app: | |
runs-on: powerfulubuntu | |
environment: ${{ github.event.inputs.environment }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ap-southeast-2 | |
role-to-assume: ${{ secrets.FLU_AWS_GITHUB_OIDC_ROLE }} | |
role-duration-seconds: 3600 #seconds | |
- name: Display Commit Hash | |
run: | | |
git checkout HEAD~1 | |
PREVIOUS_COMMIT=$(git log -1 --format='%H') | |
echo "PREVIOUS_COMMIT=$PREVIOUS_COMMIT" >> $GITHUB_ENV | |
echo "" | |
echo "CommitHash: $(git log -1 --format='%H')" | |
echo "" | |
- name: Build | |
id: build | |
uses: ./scripts/actions | |
with: | |
command: | | |
echo ${{ env.PREVIOUS_COMMIT }} | |
flu build-docker \ | |
--network ${{ github.event.inputs.network }} \ | |
--group all \ | |
--service all \ | |
--environment ${{ github.event.inputs.environment }} \ | |
--build-root-container true \ | |
--build-build-container true \ | |
--tag ${{ env.PREVIOUS_COMMIT }} | |
- name: Deploy | |
id: deploy | |
uses: ./scripts/actions | |
with: | |
command: | | |
flu deploy-service \ | |
--network ${{ github.event.inputs.network }} \ | |
--group all \ | |
--service all \ | |
--environment ${{ github.event.inputs.environment }} \ | |
--debug false \ | |
--tag ${{ env.PREVIOUS_COMMIT }} | |
- name: Discord | |
uses: ./scripts/actions | |
if: always() | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
with: | |
command: | | |
flu send-discord --webhook-url ${{ secrets.FLU_CI_DISCORD_WEBHOOK_URL }} --status ${{ job.status }} | |